private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e) { GCConfigRatedEvents ev = SelectedConfiguration; if (ev == null) { return; } List <GCConfigRatedEvents.ParameterDescriptor> pars = ev.ParameterDescriptions; if (comboBoxType.SelectedIndex >= 0 && comboBoxType.SelectedIndex < pars.Count) { GCConfigRatedEvents.ParameterDescriptor p = pars[comboBoxType.SelectedIndex]; if (p.Array != null) { comboBoxSubtype.Visible = false; InitListBoxEntries(p, -1); } else if (p.Array2 != null) { comboBoxSubtype.BeginUpdate(); comboBoxSubtype.Items.Clear(); comboBoxSubtype.Visible = true; for (int i = p.Min; i < p.Max; i++) { comboBoxSubtype.Items.Add(p.param1Func(i)); } comboBoxSubtype.EndUpdate(); comboBoxSubtype.SelectedIndex = 0; } } }
/// <summary> /// Callback from new title dialog /// this is received in two cases: /// - creation of the new configuration /// - cloning of the existing configuration /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnNewConfiguration(object sender, EventArgs e) { if (sender is RatedEventNewTitle) { RatedEventNewTitle d = sender as RatedEventNewTitle; GCConfigRatedEvents ge = GCConfigRatedManager.CreateConfiguration(d.TextValue); if (d.ExistingConfiguration != null) { ge.CopyFrom(d.ExistingConfiguration); } if (OnConfListChanged != null) { OnConfListChanged(this, e); } RatedEventDetails d1 = new RatedEventDetails(); if (OnConfListChanged != null) { d1.OnConfigurationChanged += new TBButtonPressed(OnConfListChanged); } d1.setConfig(ge); RatedEventDetailsController d1c = new RatedEventDetailsController(d1); d1c.ShowInContainer(Controller.ViewContainer, GVControlAlign.Fill); } }
private void templateComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (bEnchit) { return; } if (templateComboBox.SelectedIndex >= 0 && templateComboBox.SelectedIndex < templateComboBox.Items.Count) { if (templateComboBox.SelectedIndex == templateComboBox.Items.Count - 1) { bEnchit = true; templateComboBox.SelectedIndex = p_lastSelectedTemplateIndex; bEnchit = false; RatedEventsEditor d = new RatedEventsEditor(); d.OnConfListChanged += new TBButtonPressed(OnConfigurationListChanged); RatedEventsEditorController dc = new RatedEventsEditorController(d); dc.ShowInContainer(Controller.ViewContainer, GVControlAlign.Fill); } else { SelectedConfiguration = GCConfigRatedManager.Configurations[templateComboBox.SelectedIndex]; Properties.Settings.Default.RatedConfiguration = SelectedConfiguration.Title; Properties.Settings.Default.Save(); Recalculate(); p_lastSelectedTemplateIndex = templateComboBox.SelectedIndex; } } }
public RatedEventsTab() { InitializeComponent(); richTextBox1.Dock = DockStyle.Fill; pictureBox1.Dock = DockStyle.Fill; string s = Properties.Settings.Default.RatedLocation; if (s.Length < 1) { s = GCGlobal.LastLocation.EncodedString; } ratedLocation = new GCLocation(); ratedLocation.EncodedString = s; s = Properties.Settings.Default.RatedStartDate; if (s.Length > 1) { ratedStartDate.EncodedString = s; } s = Properties.Settings.Default.RatedEndDate; if (s.Length > 1) { ratedEndDate.EncodedString = s; } InitTemplates(); s = Properties.Settings.Default.RatedConfiguration; SelectedConfiguration = GCConfigRatedManager.GetConfiguration(s); bEnchit = true; templateComboBox.SelectedIndex = templateComboBox.Items.IndexOf(SelectedConfiguration.Title); bEnchit = false; SetMode(Properties.Settings.Default.RatedEventsShowMode); }
public void setConfig(GCConfigRatedEvents ev) { SelectedConfiguration = ev; checkBoxUsePeriod.Checked = ev.useMinPeriodLength; checkBoxUseAcceptLimit.Checked = ev.useAcceptLimit; numericPeriodLimit.Value = Convert.ToDecimal(ev.minPeriodLength); numAcceptLimit.Value = Convert.ToDecimal(ev.acceptLimit); textBox1.Text = ev.Title; richTextBox1.Text = ev.Description; InitComboBoxType(); comboBoxType.SelectedIndex = 0; }
private void comboBoxSubtype_SelectedIndexChanged(object sender, EventArgs e) { GCConfigRatedEvents ev = SelectedConfiguration; if (ev == null) { return; } List <GCConfigRatedEvents.ParameterDescriptor> pars = ev.ParameterDescriptions; if (comboBoxType.SelectedIndex >= 0 && comboBoxType.SelectedIndex < pars.Count) { GCConfigRatedEvents.ParameterDescriptor p = pars[comboBoxType.SelectedIndex]; InitListBoxEntries(p, comboBoxSubtype.SelectedIndex); } }
private void InitComboBoxType() { GCConfigRatedEvents ev = SelectedConfiguration; if (ev == null) { return; } List <GCConfigRatedEvents.ParameterDescriptor> pars = ev.ParameterDescriptions; comboBoxType.BeginUpdate(); comboBoxType.Items.Clear(); foreach (GCConfigRatedEvents.ParameterDescriptor p in pars) { comboBoxType.Items.Add(p.Key); } comboBoxType.EndUpdate(); }
private void InitListBoxEntries(GCConfigRatedEvents.ParameterDescriptor p, int index) { GCConfigRatedEvents ev = SelectedConfiguration; if (ev == null) { return; } List <GCConfigRatedEvents.ParameterDescriptor> pars = ev.ParameterDescriptions; ListBoxRichItem lbi; listBox1.BeginUpdate(); listBox1.Items.Clear(); if (p.Array != null) { for (int i = p.Min; i < p.Max; i++) { lbi = new ListBoxRichItem(); lbi.Title = p.Array[i].Title; lbi.Subtitle = string.Format("{0}, {1} subratings", p.Key, p.Array[i].MarginsCount); lbi.Tag = p.Array[i]; lbi.TitleLevel = 0; listBox1.Items.Add(lbi); } } else if (p.Array2 != null) { int i = index; for (int j = p.Min2; j < p.Max2; j++) { lbi = new ListBoxRichItem(); lbi.Title = p.Array2[i, j].Title; lbi.Subtitle = string.Format("{0}, {1} subratings", p.Key, p.Array2[i, j].MarginsCount); lbi.Tag = p.Array2[i, j]; lbi.TitleLevel = 0; listBox1.Items.Add(lbi); } } listBox1.EndUpdate(); }
private void toolStripButtonDelete_Click(object sender, EventArgs e) { if (GCConfigRatedManager.Configurations.Count < 2) { return; } GCConfigRatedEvents ev = SelectedTemplateConfig; if (ev != null) { // ask for confirmation AskDeleteObject d = new AskDeleteObject(); d.InitialLabel = "Are you sure to delete following configuration?"; d.DetailLabel = ev.Title; d.OnButtonYes += new TBButtonPressed(onDeleteConfigTemplateYes); d.Tag = ev; AskDeleteObjectController dc = new AskDeleteObjectController(d); dc.ShowInContainer(Controller.ViewContainer, GVControlAlign.Fill); } }
public RatedEventNewTitle() { InitializeComponent(); ExistingConfiguration = null; }
public void saveConfig() { GCConfigRatedEvents ev = SelectedConfiguration; if (ev == null) { return; } bool mod = false; if (ev.useAcceptLimit != checkBoxUseAcceptLimit.Checked) { ev.useAcceptLimit = checkBoxUseAcceptLimit.Checked; mod = true; } if (ev.useMinPeriodLength != checkBoxUsePeriod.Checked) { ev.useMinPeriodLength = checkBoxUsePeriod.Checked; mod = true; } if (ev.acceptLimit != Convert.ToDouble(numAcceptLimit.Value)) { ev.acceptLimit = Convert.ToDouble(numAcceptLimit.Value); mod = true; } if (ev.minPeriodLength != Convert.ToInt32(numericPeriodLimit.Value)) { ev.minPeriodLength = Convert.ToInt32(numericPeriodLimit.Value); mod = true; } if (ev.Title == null || !ev.Title.Equals(textBox1.Text)) { ev.Title = textBox1.Text; mod = true; } if (ev.Description == null || !ev.Description.Equals(richTextBox1.Text)) { ev.Description = richTextBox1.Text; mod = true; } if (!mod) { // we check all entries only in case when main properties were not changed // because we just want to know, if this object should be saved to disk List <GCConfigRatedEvents.ParameterDescriptor> pd = ev.ParameterDescriptions; foreach (GCConfigRatedEvents.ParameterDescriptor p in pd) { if (p.Array != null) { for (int i = p.Min; i < p.Max; i++) { if (p.Array[i].Modified) { mod = true; break; } } } else if (p.Array2 != null) { for (int i = p.Min; i < p.Max; i++) { for (int j = p.Min2; j < p.Max2; j++) { if (p.Array[i].Modified) { mod = true; break; } } if (mod) { break; } } } if (mod) { break; } } } if (mod) { ev.Save(ev.FileName); } }
public RatedEventDetails() { InitializeComponent(); SelectedConfiguration = null; }