public MainWindow() { InitializeComponent(); #region Dashboard // Loads data into 'Total Deadletters', 'Older than 24hrs' and 'Failed after reprocessing' charts var deadletterList = GetLiveDeadletters.GetFiles(); Total.DataContext = deadletterList.Last(); Aged.DataContext = deadletterList.Last(); Failed.DataContext = deadletterList.Last(); foreach (var data in deadletterList) { Clear1.Visibility = data.Total > 100 ? Visibility.Visible : Visibility.Hidden; Clear2.Visibility = data.AgedTotal > 100 ? Visibility.Visible : Visibility.Hidden; Clear3.Visibility = data.Failed > 100 ? Visibility.Visible : Visibility.Hidden; } // Loads data into 'This Week' chart var failed = new WeekViewModel.WeeklyDeadletters(); ThisWeek.DataContext = new WeekViewModel(failed); // Loads data into 'Today' chart var failed2 = new TodayViewModel.DailyDeadletters(); Today.DataContext = new TodayViewModel(failed2); // Loads data into 'Files' chart listViewInput.DataContext = new TypeViewModel(); #endregion }
// Displays Dashboard UI / Charts private void Button_Dashboard(object sender, RoutedEventArgs e) { var deadletterList = GetLiveDeadletters.GetFiles(); Total.DataContext = deadletterList.Last(); Aged.DataContext = deadletterList.Last(); Failed.DataContext = deadletterList.Last(); for (var index = 0; index < deadletterList.Count; index++) { var data = deadletterList[index]; Clear1.Visibility = data.Total > 100 ? Visibility.Visible : Visibility.Hidden; Clear2.Visibility = data.AgedTotal > 100 ? Visibility.Visible : Visibility.Hidden; Clear3.Visibility = data.Failed > 100 ? Visibility.Visible : Visibility.Hidden; } var failed = new WeekViewModel.WeeklyDeadletters(); ThisWeek.DataContext = new WeekViewModel(failed); var failed2 = new TodayViewModel.DailyDeadletters(); Today.DataContext = new TodayViewModel(failed2); listViewInput.DataContext = new TypeViewModel(); content_dataGrid.Visibility = Visibility.Hidden; content_alertsTop.Visibility = Visibility.Visible; content_radialGauge.Visibility = Visibility.Visible; reprocess_buttons.Visibility = Visibility.Hidden; config_LogIn.Visibility = Visibility.Hidden; config_dataGrid.Visibility = Visibility.Hidden; config_buttons.Visibility = Visibility.Hidden; Username.Text = null; Password.Password = null; }