private void BtnAddCollection_Click(object sender, RoutedEventArgs e) { var addCollectionControl = new AddCollectionControl(); _overlay.ShowContent(addCollectionControl, DialogOptionFactory.AddCollectionOptions, async(obj, args) => { await using var dbContext = new ApplicationDbContext(); await dbContext.AddCollection(addCollectionControl.CollectionName.Text);// todo: exist await WindowEx.GetCurrentFirst <MainWindow>().UpdateCollections(); await RefreshList(); }); }
private void BtnAddCollection_Click(object sender, RoutedEventArgs e) { var addCollectionControl = new AddCollectionControl(); _overlay.ShowContent(addCollectionControl, DialogOptionFactory.AddCollectionOptions, (obj, args) => { if (!SafeDbOperator.TryAddCollection(addCollectionControl.CollectionName.Text)) { return; } WindowEx.GetCurrentFirst <MainWindow>().UpdateCollections(); RefreshList(); }); }