Пример #1
0
        private void SaveSettings()
        {
            if (chkYouName.Checked != prefs.setUseFullName
                | chkListUserName.Checked != prefs.setListUserName)
            {
                string strChat = "<UseFullName value=\"" + chkYouName.Checked.ToString().ToLower() + "\"/>" +
                                 "<ListUserName value=\"" + chkListUserName.Checked.ToString().ToLower() + "\"/>";
                prefs.SaveSettings(user, "ChatSettings", strChat);
                MainForm.LoadSettings("ChatSettings");
            }

            if (chkIMTimestamps.Checked != prefs.setIMTimestamps | chkChatTimestamps.Checked != prefs.setChatTimestamps |
                numIMTimeZ.Text != prefs.setIMTimeZ | numChatTimeZ.Text != prefs.setChatTimeZ |
                txtIMStampFormat.Text != prefs.setIMStampFormat | txtChatStampFormat.Text != prefs.setChatStampFormat |
                chkSyncStamps.Checked != prefs.setSyncTimestamps)
            {
                string strStamps = "<ShowIMTimestamps value=\"" + chkIMTimestamps.Checked.ToString().ToLower() + "\"/>" +
                                   "<ShowChatTimestamps value=\"" + chkChatTimestamps.Checked.ToString().ToLower() + "\"/>" +
                                   "<IMTimeZone value=\"" + numIMTimeZ.Text + "\"/>" +
                                   "<ChatTimeZone value=\"" + numChatTimeZ.Text + "\"/>" +
                                   "<IMStampFormat value=\"" + txtIMStampFormat.Text + "\"/>" +
                                   "<ChatStampFormat value=\"" + txtChatStampFormat.Text + "\"/>" +
                                   "<SyncStampSettings value=\"" + chkSyncStamps.Checked.ToString().ToLower() + "\"/>";
                prefs.SaveSettings(user, "TimestampSettings", strStamps);
                MainForm.LoadSettings("TimestampSettings");
            }
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //Save our settings on the following conditions:
            //The user has checked the appropriet checkbox
            //The content has changed from last being loaded.
            if (chkSaveLogin.Checked != false)
            {
                //If the checkbox is checked
                if (chkSaveLogin.Checked != setSaveLogin | txtFirstName.Text != setFirstName | txtLastName.Text != setLastName | cbxLocation.Text != setLLocation)
                {
                    //If there have been any changes from when
                    //the settings were last loaded.
                    //Setting up our child node settings.
                    string strSettings = "<SaveLoginInfo value=\"" + chkSaveLogin.Checked.ToString().ToLower() + "\"/>" +
                                         "<FirstName value=\"" + txtFirstName.Text + "\"/>" +
                                         "<LastName value=\"" + txtLastName.Text + "\"/>" +
                                         "<LoginLocation value=\"" + cbxLocation.Text + "\"/>";
                    //Sending off the settings to be saved.
                    prefs.SaveSettings(txtFirstName.Text + "_" + txtLastName.Text, "LoginSettings", strSettings);
                    //Clean up the combo box that lists profiles.
                    if (cbxProfiles.Items.Contains("No profiles found."))
                    {
                        cbxProfiles.Items.Remove("No profiles found.");
                    }
                    cbxProfiles.Items.Add(txtFirstName.Text + "_" + txtLastName.Text);
                    cbxProfiles.SelectedItem = txtFirstName.Text + "_" + txtLastName.Text;
                }
            }
            else
            {
                //If unchecked, delete the login settings
                //no point in having unused information remain.
                prefs.DeleteSettings(cbxProfiles.Text, "LoginSettings");
            }

            btnLogin.Enabled = false;

            rtbStatus.Text = "Logging in...";
            Application.DoEvents();

            netcom.LoginOptions.FirstName     = txtFirstName.Text;
            netcom.LoginOptions.LastName      = txtLastName.Text;
            netcom.LoginOptions.Password      = txtPassword.Text;
            netcom.LoginOptions.StartLocation = cbxLocation.Text;
            netcom.Login();
        }