public ImportCsvPreviewControl()
    {
        InitializeComponent();

        _text = new(true, false, false) {
            Dock        = DockStyle.Fill,
            BorderStyle = BorderStyle.None,
        };
        Controls.Add(_text);
    }
Exemplo n.º 2
0
    public ConsoleControl(IWin32Window mainForm, NotebookManager manager)
    {
        InitializeComponent();
        _mainForm = mainForm;
        _manager  = manager;

        _inputText = new(false) {
            Dock = DockStyle.Fill
        };
        _inputText.SetVerticalScrollbarVisibility(SqlTextControl.ScrollbarVisibility.Auto);
        _inputText.F5KeyPress += InputText_F5KeyPress;
        _inputPanel.Controls.Add(_inputText);

        _outputFlow = new() {
            AutoSize      = true,
            AutoSizeMode  = AutoSizeMode.GrowAndShrink,
            FlowDirection = FlowDirection.TopDown
        };
        _outputPanel.Controls.Add(_outputFlow);

        Ui ui = new(this, false);

        ui.Init(_table);
        ui.Init(_executeButton, Resources.ControlPlayBlue, Resources.control_play_blue32);
        _executeButton.Margin      = Padding.Empty;
        _table.RowStyles[1].Height = ui.XHeight(4);
        _inputBorderPanel.Margin   = new(0, ui.XHeight(0.2), 0, 0);

        _outputSqlMargin   = new(ui.XWidth(1), ui.XHeight(0.5), ui.XWidth(1), ui.XHeight(0.75));
        _outputTableMargin = new(ui.XWidth(8), 0, ui.XWidth(1), ui.XHeight(0.75));
        _outputCountMargin = new(ui.XWidth(8), 0, 0, 0);
        _spacerSize        = new(0, ui.XHeight(1));

        _contextMenuStrip.SetMenuAppearance();
        ui.Init(_clearHistoryMenu, Resources.Delete, Resources.delete32);
        _outputFlow.ContextMenuStrip  = _contextMenuStrip;
        _outputPanel.ContextMenuStrip = _contextMenuStrip;

        void OptionsUpdated()
        {
            var opt = UserOptions.Instance;

            _outputPanel.BackColor = opt.GetColors()[UserOptionsColor.GRID_BACKGROUND];
        };
        OptionsUpdated();
        UserOptions.OnUpdate(this, OptionsUpdated);
    }
    public DatabaseImportCustomQueryForm(IImportSession session, string targetName, string sql)
    {
        InitializeComponent();
        _session = session;

        _sqlTextControl = new(false) { Dock = DockStyle.Fill };
        _sqlPanel.Controls.Add(_sqlTextControl);
        _sqlTextControl.SqlText = sql;

        _grid      = DataGridViewUtil.NewDataGridView();
        _grid.Dock = DockStyle.Fill;
        _previewPanel.Controls.Add(_grid);

        Ui ui = new(this, 120, 40);

        ui.Init(_table);
        ui.InitHeader(_importLabel);
        ui.Init(_importFlow);
        ui.Pad(_importFlow);
        ui.MarginBottom(_importFlow);
        ui.Init(_targetNameLabel);
        ui.Init(_targetNameText, 50);
        ui.Init(_splitter, 0.5);
        ui.Init(_sqlTable);
        ui.InitHeader(_sqlLabel);
        ui.Init(_previewToolStrip);
        ui.Init(_executeButton, Resources.ControlPlayBlue, Resources.control_play_blue32);
        ui.Init(_sqlPanel);
        ui.Init(_previewTable);
        ui.InitHeader(_previewLabel);
        ui.Init(_previewPanel);
        ui.Init(_buttonFlow);
        ui.MarginTop(_buttonFlow);
        ui.Init(_okButton);
        ui.Init(_cancelButton);

        _targetNameText.Text        = targetName;
        _sqlTextControl.F5KeyPress += delegate { Execute(); };
        Shown += delegate { _sqlTextControl.SqlFocus(); };
    }
Exemplo n.º 4
0
    public ViewFullTextForm(string text)
    {
        InitializeComponent();

        _textControl = new(true, syntaxColoring : false) {
            Dock        = DockStyle.Fill,
            SqlText     = text,
            BorderStyle = BorderStyle.FixedSingle,
        };
        _textPanel.Controls.Add(_textControl);

        Ui ui = new(this, 150, 30);

        ui.Init(_table);
        ui.Init(_textPanel);
        ui.Init(_buttonFlow1);
        ui.MarginTop(_buttonFlow1);
        ui.Init(_copyButton);
        ui.Init(_buttonFlow2);
        ui.MarginTop(_buttonFlow2);
        ui.Init(_closeButton);
    }
Exemplo n.º 5
0
 public FontForm(Font initialFont)
 {
     InitializeComponent();
     _previewPanel.Controls.Add(_previewText = new(true) { Dock = DockStyle.Fill });
Exemplo n.º 6
0
        }                                                      // the ultimate result of this form

        public ImportXlsBookForm(string filePath, DatabaseSchema schema, NotebookManager manager)
        {
            InitializeComponent();
            _filePath       = filePath;
            _databaseSchema = schema;
            _manager        = manager;

            _dockPanel = DockPanelUtil.CreateDockPanel(showWindowListButton: true);
            _dockPanel.DockTopPortion = 150;
            _dockPanelContainer.Controls.Add(_dockPanel);

            Text = $"Import {Path.GetFileName(filePath)}";

            // left pane - sheet names
            {
                _sheetsControl = new ImportXlsSheetsControl();
                _sheetsControl.ValueChanged += SheetsControl_ValueChanged;
                _sheetsLoadControl           = new LoadingContainerControl {
                    ContainedControl = _sheetsControl
                };
                var dc = new UserControlDockContent("Worksheets", _sheetsLoadControl, DockAreas.DockTop)
                {
                    CloseButtonVisible = false
                };
                dc.Show(_dockPanel, DockState.DockTop);
            }

            // import script panel
            {
                _sqlControl     = new SqlTextControl(readOnly: true);
                _sqlLoadControl = new LoadingContainerControl {
                    ContainedControl = _sqlControl
                };
                _sqlDockContent = new UserControlDockContent("Import Script", _sqlLoadControl)
                {
                    CloseButton        = false,
                    CloseButtonVisible = false,
                    ControlBox         = false,
                    Icon = Properties.Resources.ScriptIco
                };
            }

            // import preview panel
            {
                _outputPreviewControl = new ImportMultiTablePreviewControl();
                _outputPreviewControl.GeneratePreview += OutputPreviewControl_GeneratePreview;
                _outputPreviewLoadControl              = new LoadingContainerControl {
                    ContainedControl = _outputPreviewControl
                };
                _outputPreviewDockContent = new UserControlDockContent("Preview", _outputPreviewLoadControl)
                {
                    CloseButton        = false,
                    CloseButtonVisible = false,
                    ControlBox         = false,
                    Icon = Properties.Resources.TableImportIco
                };
            }

            // dummy panel shown while loading worksheet tabs
            {
                _sheetInitialLoadControl = new LoadingContainerControl {
                    ContainedControl = new Panel()
                };
                var dc = new UserControlDockContent("Loading...", _sheetInitialLoadControl)
                {
                    CloseButton        = false,
                    CloseButtonVisible = false,
                    ControlBox         = false,
                    Icon = Properties.Resources.TableSheetIco
                };
                dc.Show(_dockPanel);
                _sheetInitialLoadDockContent = dc;
            }
        }