Beispiel #1
0
    private void ExecuteAllButton_Click(object sender, EventArgs e)
    {
        AcceptAll();

        _manager.CommitOpenEditors();

        List <Action> uiThreadActions    = new();
        var           queryBlockControls = _flow.Controls.OfType <QueryBlockControl>().ToList();

        WaitForm.Go(TopLevelControl, "Page Execution", "Executing all queries...", out _, () => {
            foreach (var queryBlockControl in queryBlockControls)
            {
                var output = queryBlockControl.ExecuteOnWorkerThread();
                uiThreadActions.Add(() => {
                    queryBlockControl.Output?.Dispose();
                    queryBlockControl.Output = output;
                    queryBlockControl.Invalidate();
                });
            }
        });

        foreach (var action in uiThreadActions)
        {
            action();
        }
        OnSizeChanged(EventArgs.Empty);

        _manager.SetDirty();
        _manager.Rescan();
    }
Beispiel #2
0
    private static DatabaseSchema ReadDatabaseSchema(IWin32Window owner, NotebookManager manager)
    {
        var schema = WaitForm.Go(owner, "Import", "Reading notebook...", out var success, () =>
                                 DatabaseSchema.FromNotebook(manager.Notebook));

        if (!success)
        {
            return(null);
        }
        return(schema);
    }
Beispiel #3
0
    private static void ImportXls(
        IWin32Window owner, string filePath, NotebookManager manager, DatabaseSchema schema
        )
    {
        var input = WaitForm.Go(owner, "Import", "Reading workbook...", out var success, () =>
                                XlsInput.Load(filePath));

        if (!success)
        {
            return;
        }

        using ImportXlsForm f = new(input, manager, schema);
        f.ShowDialog(owner);
    }