예제 #1
0
 /// <summary>
 /// Fills the attribute value combo boxes when the attribute field is selected.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void attributeFieldComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         List <ComboBox> benchmarkComboBoxes =
             new List <ComboBox> {
             benchmark1ComboBox, benchmark2ComboBox, benchmark3ComboBox
         };
         foreach (ComboBox cb in benchmarkComboBoxes)
         {
             cb.Text = "";
             cb.Items.Clear();
         }
         if (attributeFieldComboBox.SelectedIndex != -1)
         {
             _transform.SetAttField(attributeFieldComboBox.SelectedItem.ToString());
             foreach (string value in _transform.GetAttValues())
             {
                 foreach (ComboBox cb in benchmarkComboBoxes)
                 {
                     cb.Items.Add(value);
                 }
             }
             for (int i = 1; i <= benchmarkComboBoxes.Count; i++)
             {
                 SetBenchmarkAttributeIndex(benchmarkComboBoxes[i - 1], i.ToString());
             }
         }
         else
         {
             _transform.SetAttField(null);
         }
         EnableSave();
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
 }
 /// <summary>
 /// Fills the attribute value comboboxes with the available attributes from the selected
 /// field and looks for defaults.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxAttField_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (comboBoxAttField.SelectedIndex > -1)
         {
             _transform.SetAttField(comboBoxAttField.SelectedItem.ToString());
             comboBoxBM1Att.Text = "";
             comboBoxBM2Att.Text = "";
             comboBoxBM3Att.Text = "";
             comboBoxBM1Att.Items.Clear();
             comboBoxBM2Att.Items.Clear();
             comboBoxBM3Att.Items.Clear();
             foreach (string value in _transform.GetAttValues())
             {
                 comboBoxBM1Att.Items.Add(value);
                 comboBoxBM2Att.Items.Add(value);
                 comboBoxBM3Att.Items.Add(value);
             }
             comboBoxBM1Att.SelectedIndex = FindBMAttIndex("1");
             comboBoxBM2Att.SelectedIndex = FindBMAttIndex("2");
             comboBoxBM3Att.SelectedIndex = FindBMAttIndex("3");
             CheckBenchmarkIds();
             groupBoxBMs.Enabled = true;
         }
         else
         {
             FormUtilities.ClearControls(groupBoxBMs);
             FormUtilities.ClearControls(groupBoxRotation);
             groupBoxBMs.Enabled      = false;
             groupBoxRotation.Enabled = false;
         }
         EnableTransform();
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
 }