private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { //StartLoaderAnimation(); if (ToolTrackerService.Officer == null) { NotifyUser.Inform("An officer must be logged in.", "Officer Not Logged In"); Environment.Exit(0); } #region Seed database //var seeder = new TestDataSeeder(); //seeder.WipeOutData(); //seeder.SeedShops(); //seeder.SeedInmates(); #endregion _toolsCheckedOutNext = new Queue <int>(); _toolsCheckedOutBack = new Queue <int>(); UpdateCheckedOutTotal(ToolTrackerService.GetCheckedOutTotal()); TextBlockLoggedInName.Text = ToolTrackerService.Officer.Name; ToolTrackerService.Inmates = new ObservableCollection <InmateViewModel>(); ToolTrackerService.Shops = new ObservableCollection <Shop>(); ToolTrackerService.Tools = new ObservableCollection <ToolViewModel>(); ToolTrackerService.CheckOutInTools = new ObservableCollection <CheckToolOutInViewModel>(); ToolTrackerService.ToolsIssued = new ObservableCollection <ToolIssuedViewModel>(); ToolTrackerService.UpdateShopsCombobox(comboBoxShops); ToolTrackerService.UpdateShopsCombobox(comboBoxShopsToolsIssued); UpdateToolsListBox(); backgroundWorkerLoad = new BackgroundWorker(); backgroundWorkerLoad.DoWork += BackgroundWorkerLoad_DoWork; backgroundWorkerLoad.RunWorkerCompleted += BackgroundWorkerLoad_RunWorkerCompleted; _busyIndicator.IsBusy = true; backgroundWorkerLoad.RunWorkerAsync(); DatePickerDate.SelectedDate = DateTime.Today; SettingsService.ReadXmlSettings(); //StopLoaderAnimation(); }
private void TabControl_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { //_counter++; //Console.WriteLine("counter: " + _counter); if (!TabItemToolsIssued.IsSelected) { comboBoxShopsToolsIssued.SelectedIndex = 0; ToolTrackerService.ToolsIssued?.Clear(); } if (TabItemCheckOutInTools.IsSelected) { TextBlockTabHeader.Text = "CHECK OUT/IN TOOLS"; } if (!TabItemCheckOutInTools.IsSelected) { comboBoxShops.SelectedIndex = 0; comboBoxInmates.SelectedIndex = 0; ToolTrackerService.CheckOutInTools.Clear(); TextBlockCheckOutTotal.Text = ToolTrackerService.GetCheckedOutTotal(); StackPanelNextPrevButtons.Visibility = Visibility.Hidden; } if (TabItemToolsIssued.IsSelected) { TextBlockTabHeader.Text = "TOOLS ISSUED"; } if (TabItemInmates.IsSelected) { TextBlockTabHeader.Text = "UPDATE INMATES"; } if (TabItemTools.IsSelected) { TextBlockTabHeader.Text = "UPDATE TOOLS"; } if (TabItemShops.IsSelected) { TextBlockTabHeader.Text = "UPDATE SHOPS"; } }