private void OldWeekGraphPage1_Loaded(object sender, RoutedEventArgs e) { BarGraphAnimations(); ((ColumnSeries)MainChart.Series[0]).ItemsSource = _productionViewModel; ((ColumnSeries)MainChart.Series[1]).ItemsSource = mainController.GetAcaf(DateTime.Now.Year - 1); int CurrentWeek = DatabaseController.GetCurrentWeek(DateTime.Now); LabelAfgelopenWeek.Content = "Totaal Afgelopen week: " + (mainController.GetProduction(DateTime.Now.Year)[CurrentWeek - 1].Burned); labelHuidigeWeek.Content = "Totaal Huidige week: " + (mainController.GetProduction(DateTime.Now.Year)[CurrentWeek].Burned); }
//safe public MainWindow(string version) { UpdateRuntime.AutoReset = true; UpdateRuntime.Elapsed += (sender, e) => Dispatcher.BeginInvoke((Action)(() => { UpdateRuntime_Tick(); })); UpdateRuntime.Start(); mainWindowHolder = this; Properties.Settings.Default.CurrentAppVersion = version; Properties.Settings.Default.Save(); pauseTimer.AutoReset = true; pauseTimer.Elapsed += (sender, e) => Dispatcher.BeginInvoke((Action)(() => { PlayBtn_Click(sender, null); })); updatePauseTime.AutoReset = true; updatePauseTime.Elapsed += (sender, e) => Dispatcher.BeginInvoke((Action)(() => { UpdatePauseBar(); })); timer.AutoReset = true; timer.Elapsed += (sender, e) => NextSlide(); timer.Start(); updateTimer.AutoReset = true; updateTimer.Elapsed += (sender, e) => UpdateOldTimer(); updateTimer.Start(); //Most exceptions propagate till this point, so any uncaught ones that I didn't catch before should end up here... Hopefully... try { InitializeComponent(); } catch (Exception ex) { Application.Current.Dispatcher.Invoke((() => { MainController.SendErrorMessage(ex); })); Process.Start(Application.ResourceAssembly.Location); Application.Current.Dispatcher.BeginInvoke((Action)(() => { Application.Current.Shutdown(); })); } tmr = new System.Timers.Timer(10); tmr.AutoReset = true; tmr.Elapsed += MoveTicker_Tick; tmr.Start(); stopwatch = new Stopwatch(); stopwatch.Start(); if (Properties.Settings.Default.CurrentAppVersion == "kantoor") { PlayBtn.Visibility = Visibility.Collapsed; PauseBtn.Visibility = Visibility.Collapsed; NextBtn.Visibility = Visibility.Collapsed; } int CurrentWeek = DatabaseController.GetCurrentWeek(DateTime.Now); ActueleWeekProductie.Text = "Actuele Productie: " + (mainController.GetProduction(DateTime.Now.Year)[CurrentWeek].Burned); ActueleWeekAanvoer.Text = "Actuele Aanvoer: " + (mainController.GetAcaf(DateTime.Now.Year)[CurrentWeek]).Value; PageFrame.NavigationUIVisibility = NavigationUIVisibility.Hidden; GetAndSetRssMain(); GetAndSetRssBackup(); var descriptor = DependencyPropertyDescriptor.FromProperty(ActualWidthProperty, typeof(TextBlock)); if (descriptor != null) { descriptor.AddValueChanged(HeadlineContainerMain, ActualWidth_ValueChanged); } Canvas2X = Canvas1Width + 1920; Canvas.SetLeft(HeadlineContainerBackup, Canvas2X); }