private void SetDefaults() { EnumTypeConverter conv = new EnumTypeConverter(typeof(SendSettings.LineEnds)); foreach (com232term.Classes.Options.SendSettings.LineEnds a in SendSettings.LineEndsList) { string b = conv.ConvertToString(a); ToolStripMenuItem item = new ToolStripMenuItem() { Tag = a, Text = b, CheckOnClick = true }; item.Click += new EventHandler(itemLineEnd_Click); this.mButtonLineEnd.DropDownItems.Add(item); } foreach (com232term.Classes.Options.SendSettings.ParseFormats a in SendSettings.ParseFormatsList) { ToolStripMenuItem item = new ToolStripMenuItem() { Tag = a, Text = a.ToString(), CheckOnClick = true }; item.Click += new EventHandler(itemParseFormat_Click); this.mButtonFormat.DropDownItems.Add(item); } this.mComboBoxConsole.ComboBox.DataSource = this.mSender.Packets; }
private void ReflectSettingsToGui() { foreach (ToolStripItem item in this.mButtonLineEnd.DropDownItems) { ToolStripMenuItem menuItem = item as ToolStripMenuItem; if (menuItem != null) { com232term.Classes.Options.SendSettings.LineEnds end = (com232term.Classes.Options.SendSettings.LineEnds)menuItem.Tag; menuItem.Checked = (end == this.mSender.Settings.LineEnd); } } EnumTypeConverter conv = new EnumTypeConverter(typeof(SendSettings.LineEnds)); this.mButtonLineEnd.Text = conv.ConvertToString(this.mSender.Settings.LineEnd); foreach (ToolStripItem item in this.mButtonFormat.DropDownItems) { ToolStripMenuItem menuItem = item as ToolStripMenuItem; if (menuItem != null) { com232term.Classes.Options.SendSettings.ParseFormats end = (com232term.Classes.Options.SendSettings.ParseFormats)menuItem.Tag; menuItem.Checked = (end == this.mSender.Settings.Format); } } this.mButtonFormat.Text = this.mSender.Settings.Format.ToString(); }