Beispiel #1
0
        private async void Import(TableTreeViewItemViewModel viewModel)
        {
            try
            {
                var dataTable    = viewModel.Source.ExportTable2();
                var dataBaseName = this.cremaAppHost.DataBaseName;
                var dataBase     = await this.DataBaseContext.Dispatcher.InvokeAsync(() => this.DataBaseContext[dataBaseName]);

                var comment = await this.GetCommentAsync(viewModel.DisplayName);

                if (comment == null)
                {
                    return;
                }

                var dialog = new ProgressViewModel
                {
                    DisplayName = viewModel.DisplayName
                };
                await dialog.ShowDialogAsync(() => dataBase.ImportAsync(this.authenticator, dataTable.DataSet, comment));
            }
            catch (Exception e)
            {
                await AppMessageBox.ShowErrorAsync(e);
            }
        }