protected async override void OnInitialized(EventArgs e) { base.OnInitialized(e); SqlHelpers.GenerateNewDb(); MainWindowModel context = new MainWindowModel(); this.DataContext = context; InventoryList.ItemsSource = context.InventoryList; PrintList.ItemsSource = context.PrintList; InventoryList.IsEnabled = false; //LoadInventories.WorkerReportsProgress = true; //LoadInventories.DoWork += LoadInventories_DoWork; //LoadInventories.ProgressChanged += LoadInventories_ProgressChanged; //LoadInventories.RunWorkerCompleted += LoadInventories_RunWorkerCompleted; //LoadInventories.RunWorkerAsync(NumberOfInventories()); await LoadInventoryAsync(context); InventoryList.IsEnabled = true; await LoadColumnVisibility(context); CollectionView view = CollectionViewSource.GetDefaultView(InventoryList.ItemsSource) as CollectionView; view.Filter = InventoryFilter; }
private void ResetDb_Click(object sender, RoutedEventArgs e) { var result = CustomMessageBox.ShowYesNo("An instance of the database will be backed up. Do you wish to continue?", "WARNING!!!", "Yes", "No"); if (result == MessageBoxResult.Yes) { SqlHelpers.GenerateNewDb(resetDb: true); } }