Ejemplo n.º 1
0
        private void OnSaveClick(object sender, EventArgs e)
        {
            try
            {
                if (chkSqlAuth.Checked)
                {
                    ServerCollection.Add(new ServerInfo
                    {
                        Name       = txtServerName.Text,
                        Credential = new Credential
                        {
                            Username = txtUsername.Text,
                            Password = txtPassword.Text
                        }
                    });
                }
                else
                {
                    ServerCollection.Add(txtServerName.Text);
                }

                _serverBindingSource.DataSource = ServerCollection.GetAll();

                lblConnectionString.Visible = true;
                AddServerPanel.SendToBack();

                MessageBox.Show(string.Format("Server: {0} added successfully.", txtServerName.Text),
                                Resources.DataSavedCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Resources.ErrorOccured);
            }
        }
Ejemplo n.º 2
0
        private void OnAddNewButtonClick(object sender, EventArgs e)
        {
            try
            {
                if (AuthRequired.Checked)
                {
                    ServerCollection.Add(new ServerInfo
                    {
                        Name       = ServersCombo.Text,
                        Credential = new Credential
                        {
                            Username = txtUsername.Text,
                            Password = txtPassword.Text
                        }
                    });
                }
                else
                {
                    ServerCollection.Add(ServersCombo.Text);
                }

                _serverBindingSource.DataSource = ServerCollection.GetAll();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Resources.ErrorOccured);
            }
        }
Ejemplo n.º 3
0
 private void BindServers()
 {
     _serverBindingSource.DataSource = ServerCollection.GetAll();
     ddlServers.DisplayMember        = "Name";
     ddlServers.DataSource           = _serverBindingSource;
 }