protected async override void OnExecute(object parameter)
        {
            if (this.cremaAppHost.GetService(typeof(IDataBase)) is IDataBase dataBase)
            {
                var viewModel = parameter as TreeViewItemViewModel;

                var query = from item in viewModel.Items
                            where item.Target is ITable
                            let table = item.Target as ITable
                                        select table;

                var paths = await dataBase.Dispatcher.InvokeAsync(() =>
                {
                    return(query.Where(item => item.VerifyAccessType(this.authenticator, AccessType.Guest)).
                           Select(item => item.Path).
                           Distinct().
                           ToArray());
                });

                if (paths.Any() == false)
                {
                    await AppMessageBox.ShowAsync(Resources.Message_NoneTablesToExport);
                }
                else
                {
                    var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, this.cremaAppHost, paths);

                    if (dialog != null)
                    {
                        await dialog.ShowDialogAsync();
                    }
                }
            }
        }
Пример #2
0
        protected override async void OnExecute(object parameter)
        {
            var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, this.cremaAppHost);

            if (dialog.IsExporting)
            {
                AppMessageBox.Show("Now exporting.");
                return;
            }

            if (dialog.LastExportedTables == null || !dialog.LastExportedTables.Any())
            {
                AppMessageBox.Show("No table to export because there is no last export.");
                return;
            }

            if (dialog.CanExport == false)
            {
                AppMessageBox.Show("Could not export.");
                return;
            }

            var exportTask = dialog.QuickExportAsync(false, () => dialog?.TryClose());

            dialog?.ShowDialog();

            await exportTask;
        }
Пример #3
0
 protected async override void OnExecute(object parameter)
 {
     if (parameter is ITableDescriptor descriptor)
     {
         var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, descriptor);
         dialog?.ShowDialog();
     }
 }
        protected async override void OnExecute(object parameter)
        {
            if (parameter is ISelector selector)
            {
                if (selector.SelectedItem is ITableCategoryDescriptor categoryDescriptor)
                {
                    var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, categoryDescriptor);

                    await dialog?.ShowDialogAsync();
                }
                else if (selector.SelectedItem is ITableDescriptor tableDescriptor)
                {
                    var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, tableDescriptor);

                    await dialog?.ShowDialogAsync();
                }
            }
        }
Пример #5
0
        protected async override void OnExecute(object parameter)
        {
            var dialog = await ExportViewModel.CreateInstanceAsync(this.authenticator, this.cremaAppHost);

            await dialog?.ShowDialogAsync();
        }