private void btnReport_Click(object sender, RoutedEventArgs e) { selectNav(sender as Button); if (reportPage == null) { reportPage = new page.pageReport(); } showPage(reportPage); }
private void Window_Loaded(object sender, RoutedEventArgs e) { System.Threading.Thread thread = new System.Threading.Thread(() => { Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { homePage = new page.pageHome(); loginPage = new page.pageLogin(); reportPage = new page.pageReport(); settingsPage = new page.pageSettings(); btnHome_Click(btnHome, new RoutedEventArgs()); })); }); thread.SetApartmentState(System.Threading.ApartmentState.STA); thread.Start(); threadLastReport = new System.Threading.Thread(() => { try { while (true) { classes.Job.Database.rpLast = null; classes.Job.Database.getLastReport(); Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { gvSticker.DataContext = classes.Job.Database.getLastReport(); })); System.Threading.Thread.Sleep(2500); try { } catch (System.Threading.ThreadAbortException abortException) { throw abortException; } catch (Exception ex) { Console.WriteLine("gSliderError#2:" + ex); } } } catch (Exception ex) { Console.WriteLine("gSliderError#1:" + ex); } }); threadLastReport.Start(); startMarquee(canvas1, marquee1, 20); startMarquee(canvas2, marquee2, 20); startMarquee(canvas3, marquee3, 20); startMarquee(canvas4, marquee4, 20); }