private void EditTrigger_Click(object sender, EventArgs e) { Group g = ((Control)sender).Tag as Group; BaseUtils.ConditionLists res = ShowFilterDialog(g.triggercondition, string.Format("Edit Profile {0} Trigger".T(EDTx.ProfileEditor_TrigEdit), g.name.Text)); if (res != null) { g.triggercondition = res; disabletriggers = true; g.stdtrigger.SelectedIndex = EDDProfiles.FindTriggerIndex(g.triggercondition, g.backcondition) + 1; disabletriggers = false; } }
private void EditBack_Click(object sender, EventArgs e) { Group g = ((Control)sender).Tag as Group; ConditionFilterForm frm = new ConditionFilterForm(); frm.InitCondition(string.Format("Edit Profile {0} Back Trigger".Tx(this, "BackEdit"), g.name.Text), this.Icon, new List <string>(), g.backcondition); if (frm.ShowDialog() == DialogResult.OK) { g.backcondition = frm.result; disabletriggers = true; g.stdtrigger.SelectedIndex = EDDProfiles.FindTriggerIndex(g.triggercondition, g.backcondition) + 1; disabletriggers = false; } }
private void AddProfile(int id, string name, ConditionLists tripcondition, ConditionLists backcondition, bool poweron) { Group g = new Group(); g.Id = id; g.panel = new Panel(); g.panel.BorderStyle = BorderStyle.FixedSingle; g.panel.Tag = g; g.name = new ExtendedControls.RichTextBoxScroll(); g.name.Location = new Point(4, textheightmargin); // 8 spacing, allow 8*4 to indent g.name.Size = new Size(200, 24); g.name.Text = name; g.panel.Controls.Add(g.name); g.stdtrigger = new ExtendedControls.ComboBoxCustom(); g.stdtrigger.Location = new Point(210, textheightmargin); // 8 spacing, allow 8*4 to indent g.stdtrigger.Size = new Size(200, 24); g.stdtrigger.Items.Add("Custom".Tx(this)); g.stdtrigger.Items.AddRange(EDDProfiles.StandardTriggers.Select((p1) => p1.Name)); g.stdtrigger.SelectedIndex = EDDProfiles.FindTriggerIndex(tripcondition, backcondition) + 1; g.stdtrigger.SelectedIndexChanged += Stdtrigger_SelectedIndexChanged; g.stdtrigger.Tag = g; g.panel.Controls.Add(g.stdtrigger); g.edittriggerbutton = new ExtendedControls.ButtonExt(); g.edittriggerbutton.Location = new Point(420, textheightmargin); g.edittriggerbutton.Size = new Size(100, 24); g.edittriggerbutton.Text = "Trigger".Tx(this); g.edittriggerbutton.Tag = g; g.edittriggerbutton.Click += EditTrigger_Click; g.panel.Controls.Add(g.edittriggerbutton); g.editbacktriggerbutton = new ExtendedControls.ButtonExt(); g.editbacktriggerbutton.Location = new Point(530, textheightmargin); g.editbacktriggerbutton.Size = new Size(100, 24); g.editbacktriggerbutton.Text = "Back".Tx(this); g.editbacktriggerbutton.Tag = g; g.editbacktriggerbutton.Click += EditBack_Click; g.panel.Controls.Add(g.editbacktriggerbutton); g.chkbox = new ExtendedControls.CheckBoxCustom(); g.chkbox.Location = new Point(640, textheightmargin); g.chkbox.Size = new Size(150, 24); g.chkbox.Text = "Default".Tx(this); g.chkbox.Tag = g; g.chkbox.Checked = poweron; g.chkbox.Click += Chkbox_Click; g.panel.Controls.Add(g.chkbox); g.deletebutton = new ExtendedControls.ButtonExt(); g.deletebutton.Location = new Point(panelVScrollMain.Width - 60, textheightmargin); g.deletebutton.Size = new Size(24, 24); g.deletebutton.Text = "X"; g.deletebutton.Tag = g; g.deletebutton.Click += Deletebutton_Click; g.panel.Controls.Add(g.deletebutton); g.triggercondition = new ConditionLists(tripcondition); // copy so we can edit g.backcondition = new ConditionLists(backcondition); EDDiscovery.EDDTheme.Instance.ApplyToControls(g.panel, label_index.Font); panelVScrollMain.Controls.Add(g.panel); groups.Add(g); }
private void AddProfile(int id, string name, ConditionLists tripcondition, ConditionLists backcondition, bool poweron) { Group g = new Group(); // We draw as it was 8.25 point then scale. g.Id = id; g.panel = new Panel(); g.panel.BorderStyle = BorderStyle.FixedSingle; g.panel.Tag = g; const int vpos = 3; g.name = new ExtendedControls.ExtRichTextBox(); g.name.Location = new Point(4, vpos); // 8 spacing, allow 8*4 to indent g.name.Size = new Size(200, 24); g.name.Text = name; g.panel.Controls.Add(g.name); g.stdtrigger = new ExtendedControls.ExtComboBox(); g.stdtrigger.Location = new Point(210, vpos); // 8 spacing, allow 8*4 to indent g.stdtrigger.Size = new Size(200, 24); g.stdtrigger.Items.Add("Custom".T(EDTx.ProfileEditor_Custom)); g.stdtrigger.Items.AddRange(EDDProfiles.StandardTriggers.Select((p1) => p1.Name)); g.stdtrigger.SelectedIndex = EDDProfiles.FindTriggerIndex(tripcondition, backcondition) + 1; g.stdtrigger.SelectedIndexChanged += Stdtrigger_SelectedIndexChanged; g.stdtrigger.Tag = g; g.panel.Controls.Add(g.stdtrigger); g.edittriggerbutton = new ExtendedControls.ExtButton(); g.edittriggerbutton.Location = new Point(420, vpos); g.edittriggerbutton.Size = new Size(100, 24); g.edittriggerbutton.Text = "Trigger".T(EDTx.ProfileEditor_Trigger); g.edittriggerbutton.Tag = g; g.edittriggerbutton.Click += EditTrigger_Click; g.panel.Controls.Add(g.edittriggerbutton); g.editbacktriggerbutton = new ExtendedControls.ExtButton(); g.editbacktriggerbutton.Location = new Point(530, vpos); g.editbacktriggerbutton.Size = new Size(100, 24); g.editbacktriggerbutton.Text = "Back".T(EDTx.ProfileEditor_Back); g.editbacktriggerbutton.Tag = g; g.editbacktriggerbutton.Click += EditBack_Click; g.panel.Controls.Add(g.editbacktriggerbutton); g.chkbox = new ExtendedControls.ExtCheckBox(); g.chkbox.Location = new Point(640, vpos); g.chkbox.Size = new Size(100, 24); g.chkbox.Text = "Default".T(EDTx.ProfileEditor_Default); g.chkbox.Tag = g; g.chkbox.Checked = poweron; g.chkbox.Click += Chkbox_Click; g.panel.Controls.Add(g.chkbox); g.deletebutton = new ExtendedControls.ExtButton(); g.deletebutton.Location = new Point(740, vpos); g.deletebutton.Size = new Size(24, 24); g.deletebutton.Text = "X"; g.deletebutton.Tag = g; g.deletebutton.Click += Deletebutton_Click; g.panel.Controls.Add(g.deletebutton); g.triggercondition = new ConditionLists(tripcondition); // copy so we can edit g.backcondition = new ConditionLists(backcondition); ExtendedControls.Theme.Current.ApplyDialog(g.panel); g.panel.Scale(this.CurrentAutoScaleFactor()); panelVScrollMain.Controls.Add(g.panel); groups.Add(g); }