Example #1
0
        private void btnEditConn_Click(object sender, EventArgs e)
        {
            // редактирование настроек
            ServersSettings.ServerSettings serverSettings = SelectedSettings;
            string oldName = serverSettings.Connection.Name;

            FrmConnSettings frmConnSettings = new FrmConnSettings()
            {
                ConnectionSettings = serverSettings.Connection,
                ExistingNames      = ServersSettings.GetExistingNames(oldName)
            };

            if (frmConnSettings.ShowDialog() == DialogResult.OK)
            {
                // обновление наименования, если оно изменилось
                if (!string.Equals(oldName, serverSettings.Connection.Name, StringComparison.Ordinal))
                {
                    serversSettings.Servers.Remove(oldName);
                    cbConnection.BeginUpdate();
                    cbConnection.Items.RemoveAt(cbConnection.SelectedIndex);
                    AddToLists(serverSettings);
                    cbConnection.EndUpdate();
                }

                // сохранение настроек
                SaveServersSettings();
            }
        }
Example #2
0
        private void btnEditConn_Click(object sender, EventArgs e)
        {
            // editing settings
            ServersSettings.ServerSettings serverSettings = SelectedSettings;
            string oldName = serverSettings.Connection.Name;

            var frmConnSettings = new FrmConnSettings()
            {
                ConnectionSettings = serverSettings.Connection,
                ExistingNames      = ServersSettings.GetExistingNames(oldName)
            };

            if (frmConnSettings.ShowDialog() == DialogResult.OK)
            {
                // name update if it has changed
                if (!string.Equals(oldName, serverSettings.Connection.Name, StringComparison.Ordinal))
                {
                    serversSettings.Servers.Remove(oldName);
                    cbConnection.BeginUpdate();
                    cbConnection.Items.RemoveAt(cbConnection.SelectedIndex);
                    AddToLists(serverSettings);
                    cbConnection.EndUpdate();
                }

                // saving settings
                SaveServersSettings();
            }
        }
Example #3
0
        private void btnCreateConn_Click(object sender, EventArgs e)
        {
            // создание новых настроек
            ServersSettings.ServerSettings serverSettings = new ServersSettings.ServerSettings();
            FrmConnSettings frmConnSettings = new FrmConnSettings()
            {
                ConnectionSettings = serverSettings.Connection,
                ExistingNames      = ServersSettings.GetExistingNames()
            };

            if (frmConnSettings.ShowDialog() == DialogResult.OK)
            {
                AddToLists(serverSettings);
                SaveServersSettings();
            }
        }
Example #4
0
        private void btnCreateConn_Click(object sender, EventArgs e)
        {
            // creating new settings
            var serverSettings  = new ServersSettings.ServerSettings();
            var frmConnSettings = new FrmConnSettings()
            {
                ConnectionSettings = serverSettings.Connection,
                ExistingNames      = ServersSettings.GetExistingNames()
            };

            if (frmConnSettings.ShowDialog() == DialogResult.OK)
            {
                AddToLists(serverSettings);
                SaveServersSettings();
            }
        }