private void cmdExport(object sender, RoutedEventArgs e) { DataTable dt = new DataTable(); dt = ExcelMain.grid_To_DataTable(GridView); ExcelMain.grid_To_DataTable(GridView); ExcelMain.ToExcel("test.xls", dt, "sheet1"); // ExcelMain.ToExcel("test.xls", dt,"sheet1"); }
static DataHandler() { Timer = new Timer(TimeSpan.FromMinutes(30).TotalMilliseconds); Timer.Elapsed += Timer_Elapsed; if (Program.LoadExcel) { ExcelMain.LoadExcelData(); } Task.Run(LoadData).ContinueWith(_ => NewData?.Invoke(default, EventArgs.Empty)).ContinueWith(_ => Timer_Elapsed(null, null));