예제 #1
0
        public void ChangeAccountSettings(TreeNode thisNode, string accountEndpoint)
        {
            this.treeView1.SelectedNode = thisNode;

            for (int i = 0; i < Settings.Default.AccountSettingsList.Count; i = i + 2)
            {
                if (string.Compare(accountEndpoint, Properties.Settings.Default.AccountSettingsList[i], StringComparison.OrdinalIgnoreCase) == 0)
                {
                    AccountSettings accountSettings = (AccountSettings)JsonConvert.DeserializeObject(Settings.Default.AccountSettingsList[i + 1], typeof(AccountSettings));

                    // Bring up account setings dialog
                    SettingsForm dlg = new SettingsForm();
                    dlg.AccountEndpoint = accountEndpoint;
                    dlg.AccountSettings = accountSettings;

                    DialogResult dr = dlg.ShowDialog(this);
                    if (dr == DialogResult.OK)
                    {
                        thisNode.Remove();
                        RemoveAccountFromSettings(dlg.AccountEndpoint);
                        AddAccountToSettings(dlg.AccountEndpoint, dlg.AccountSettings);
                    }

                    break;
                }
            }
        }
예제 #2
0
 private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     // Bring up account setings dialog
     SettingsForm dlg = new SettingsForm();
     DialogResult dr = dlg.ShowDialog(this);
     if (dr == DialogResult.OK)
     {
         this.AddAccountToSettings(dlg.AccountEndpoint, dlg.AccountSettings);
     }
 }