Exemplo n.º 1
0
        private async void Import(TableTreeViewItemViewModel viewModel)
        {
            try
            {
                var dataTable    = viewModel.Source.ExportTable2();
                var dataBaseName = this.cremaAppHost.DataBaseName;
                var dataBase     = await this.cremaHost.Dispatcher.InvokeAsync(() => this.cremaHost.DataBases[dataBaseName]);

                var comment = this.GetComment(viewModel.DisplayName);
                if (comment == null)
                {
                    return;
                }

                var dialog = new ProgressViewModel();
                dialog.DisplayName = viewModel.DisplayName;
                dialog.ShowDialog(() =>
                {
                    this.cremaHost.Dispatcher.Invoke(() => dataBase.TableContext.Import(this.authenticator, dataTable.DataSet, comment));
                });
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
            }
        }