private void SaveButton_Click(object sender, EventArgs e)
        {
            if (username != UserNameTextBox.Text | pass != PasswordTextBox.Text | url != ServerAddrTextBox.Text | api != ApiKeyTextBox.Text | usernamePassCh != LoginPassRadioButton.Checked)
            {
                if (Properties.Settings.Default.OldCommits)
                {
                    DialogResult result = MessageBox.Show("If you save the new user settings your local commits\r\nwill be discarded. Continue?", "Local time commits left", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                    if (result == DialogResult.Yes)
                    {
                        BuisinessLogicClass.OldCommits(false);
                    }
                    else
                    {
                        return;
                    }
                }
                DialogResult = DialogResult.Yes;
            }
            else
            {
                DialogResult = DialogResult.OK;
            }

            int counter = 0;

            for (int x = 0; x < ServerAddrTextBox.Text.Length; x++)
            {
                if (ServerAddrTextBox.Text.Substring(x, 1) == "/")
                {
                    counter++;
                }
                if (counter == 4)
                {
                    ServerAddrTextBox.Text = ServerAddrTextBox.Text.Remove(x, ServerAddrTextBox.Text.Length - x);
                    break;
                }
            }

            Properties.Settings.Default.RedmineAddress = ServerAddrTextBox.Text;
            Properties.Settings.Default.LoginType      = false;
            if (LoginPassRadioButton.Checked)
            {
                Properties.Settings.Default.LoginType = true;
            }
            Properties.Settings.Default.UserName     = UserNameTextBox.Text;
            Properties.Settings.Default.Password     = PasswordTextBox.Text;
            Properties.Settings.Default.ApiKey       = ApiKeyTextBox.Text;
            Properties.Settings.Default.RunAtStartUp = RunStartupCheckBox.Checked;
            Properties.Settings.Default.AutoSaving   = DataSavingCheckBox.Checked;

            Properties.Settings.Default.Save();

            Close();
        }
Exemple #2
0
 private void OldCommits()
 {
     if (BuisinessLogicClass.CheckForOldCommits())
     {
         DialogResult result = MessageBox.Show("Local commits left\r\nYES - send 'em to server\r\nNO - delete 'em\r\nCANCEL - work offline", "Local time commits", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
         if (result == DialogResult.Yes)
         {
             BuisinessLogicClass.OldCommits(true);
             MessageBox.Show("The commits where succesfully logged to " + Properties.Settings.Default.RedmineAddress, "Local time commits", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         if (result == DialogResult.No)
         {
             BuisinessLogicClass.OldCommits(false);
             MessageBox.Show("The commits where deleted.", "Local time commits", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         if (result == DialogResult.Cancel)
         {
             Properties.Settings.Default.Connection = false;
         }
     }
 }