예제 #1
0
        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();
            });
        }
예제 #2
0
        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();
            });
        }