public SettingsForm(AppSettings s) { InitializeComponent(); fillingForm = true; this.Settings = s; this.lblMissingPwd.Visible = false; this.lblMissingUser.Visible = false; this.lblUserConflict.Visible = false; this.lblDomainConflict.Visible = false; this.lblTitleRegexInvalid.Visible = false; txts = new TextBox[][] { new TextBox[] { this.txtAuthorsSpam, this.txtAuthorsGood }, new TextBox[] { this.txtDomainsSpam, this.txtDomainsGood }, new TextBox[] { this.txtTitlesGood }, new TextBox[] { this.txtTitlesSpam } }; warningLabels = new Label[] { this.lblUserConflict, this.lblDomainConflict, this.lblTitleRegexInvalid, this.lblTitleRegexInvalid }; MapPropsToForm(s); oldIndex = -1; this.comboBox1.SelectedIndex = 0; fillingForm = false; comboBox1_SelectedIndexChanged(null, null); }
private void MapPropsToForm(AppSettings s, string queueName=null) { this.txtUser.Text = s.RedditUser; this.txtPwd.Text = s.RedditPwd; this.chkSavePwd.Checked = s.SavePassword; this.chkSpamIsAsSpamDoes.Checked = s.SpamIsAsSpamDoes; this.txtInterval.Text = s.CheckInterval.ToString(); if (queueName == null) MapQueueSpecificPropsToForm(s); else { var z = this.Settings.OtherQueues .Where(x => x.Name == queueName) .Select(x => x); if (z.Count() == 1) MapQueueSpecificPropsToForm(z.First()); } this.txtBrowserExe.Text = this.Settings.PreferredBrowserExe; txtUser_TextChanged(null, null); txtPwd_TextChanged(null, null); }