示例#1
0
        /// <summary>
        /// Handles the click event for the <see cref="TestConnectionButton"/>.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void TestConnectionButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            DialogOKButton.Enabled = false;
            NewMachine.Name        = HostTextBox.Text.Trim();
            NewMachine.User        = UserTextBox.Text.Trim();
            NewMachine.Password    = MySqlSecurity.EncryptPassword(PasswordTextBox.Text);
            if (TestConnectionAndPermissionsSet(true))
            {
                InfoDialog.ShowDialog(InfoDialogProperties.GetSuccessDialogProperties(Resources.ConnectionSuccessfulTitle, Resources.ConnectionSuccessfulMessage));
                DialogOKButton.Enabled = true;
            }

            Cursor = Cursors.Default;
        }
示例#2
0
        /// <summary>
        /// Event delegate method fired when the <see cref="EditButton"/> is clicked.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void EditButton_Click(object sender, EventArgs e)
        {
            string oldUser     = NewMachine.User;
            string oldPassword = NewMachine.Password;

            using (var windowsConnectionDialog = new WindowsConnectionDialog(MachinesList, NewMachine))
            {
                if (windowsConnectionDialog.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                HasChanges = true;
                NewMachine.CopyMachineData(windowsConnectionDialog.NewMachine,
                                           oldUser != windowsConnectionDialog.NewMachine.User ||
                                           MySqlSecurity.DecryptPassword(oldPassword) != windowsConnectionDialog.NewMachine.UnprotectedPassword);
                MachinesList.ChangeMachine(NewMachine, ListChangeType.Updated);
                RefreshList();
            }
        }