示例#1
0
 private void Tabs_TabIndexChanged(object sender, EventArgs e)
 {
     if (_tabs.SelectedIndex == 0)
     {
         // "Basic" tab is now selected.
         UpdateBasicOptionsUi(_session.GetBasicOptions(_builder));
     }
     else
     {
         // "Advanced" tab is now selected.
         _session.SetBasicOptions(_builder, ReadBasicOptionsUi());
         _propertyGrid.SelectedObject = _builder; // Refresh the property grid.
     }
 }
示例#2
0
    public DatabaseConnectionForm(string title, DbConnectionStringBuilder builder, IImportSession session)
    {
        InitializeComponent();

        _builder = builder;
        _session = session;

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

        ui.Init(_table);
        ui.Init(_tabs);
        ui.Init(_basicTable);
        ui.Pad(_basicTable);
        ui.Init(_addressLabel);
        ui.Init(_serverTxt);
        ui.Init(_databaseLabel);
        ui.MarginTop(_databaseLabel);
        ui.Init(_databaseTxt);
        ui.Init(_usernameLabel);
        ui.MarginTop(_usernameLabel);
        ui.Init(_usernameTxt);
        ui.Init(_passwordLabel);
        ui.MarginTop(_passwordLabel);
        ui.Init(_passwordTxt);
        ui.Init(_windowsAuthChk);
        ui.MarginTop(_windowsAuthChk);
        ui.Init(_propertyGrid);
        ui.Init(_buttonFlow1);
        ui.MarginTop(_buttonFlow1);
        ui.Init(_clearButton);
        ui.Init(_buttonFlow2);
        ui.MarginTop(_buttonFlow2);
        ui.Init(_okBtn);
        ui.Init(_cancelBtn);

        if (builder is not SqlConnectionStringBuilder)
        {
            _windowsAuthChk.Visible = false;
        }
        if (builder is MySqlConnectionStringBuilder)
        {
            _databaseLabel.Text = "&Schema name:";
        }
        _propertyGrid.SelectedObject = builder;
        Text = title;

        UpdateBasicOptionsUi(_session.GetBasicOptions(builder)); // populate basic options with info from builder

        Load += delegate { _serverTxt.Select(); };
    }