You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.4 KiB

using Dapper;
using Microsoft.EntityFrameworkCore;
using Models;
using System.Collections.ObjectModel;
using System.Configuration;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
namespace WpfApp4
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
DispatcherTimer PutTimer;
public MainWindow()
{
InitializeComponent();
PutTimer = new DispatcherTimer();
PutTimer.Tick += new EventHandler(PutTimer_Tick);
PutTimer.Interval = TimeSpan.FromSeconds(60); //设置刷新的间隔时间
PutTimer.Start();
}
private void PutTimer_Tick(object sender, EventArgs e)
{
this.Dispatcher.BeginInvoke(new Action(() =>
{
//using (var context = new JobDbContext())
//{
// var connection = context.Database.GetDbConnection();
// var logs = connection.Query<Logs>("select top 500 * from Logs");
// this.dataGrid1.ItemsSource = logs;
//}
}));
}
}
}