示例#1
0
 /// <summary>
 /// Fills the list of attribute fields when the control points are selected.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void controlPointsComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         attributeFieldComboBox.Text = "";
         attributeFieldComboBox.Items.Clear();
         if (controlPointsComboBox.SelectedIndex != -1)
         {
             _transform.SetControlPoints((IFeatureClassName)controlPointsComboBox.SelectedItem);
             foreach (string fieldName in _transform.GetAttFields())
             {
                 attributeFieldComboBox.Items.Add(fieldName);
             }
             for (int i = 0; i < attributeFieldComboBox.Items.Count; i++)
             {
                 if (attributeFieldComboBox.Items[i].ToString().ToUpper() == "DESCRIPTION")
                 {
                     attributeFieldComboBox.SelectedIndex = i;
                     break;
                 }
             }
         }
         else
         {
             _transform.SetControlPoints(null);
         }
         EnableSave();
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
 }
 /// <summary>
 /// Adds the control points file to the transform object, fills the attribute field
 /// combobox, and changes the color of the file in the data list.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void comboBoxControlPts_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         comboBoxAttField.Text = "";
         comboBoxAttField.Items.Clear();
         if (comboBoxControlPts.SelectedIndex == -1)
         {
             _transform.SetControlPoints(null);
             _controlPtsOK       = false;
             groupBoxBMs.Enabled = false;
             foreach (ListViewItem item in listViewData.Items)
             {
                 item.SubItems[2].ForeColor = Color.Blue;
             }
         }
         else
         {
             IDatasetName controlPtsName = (IDatasetName)comboBoxControlPts.SelectedItem;
             _transform.SetControlPoints((IFeatureClassName)controlPtsName);
             foreach (string fieldName in _transform.GetAttFields())
             {
                 comboBoxAttField.Items.Add(fieldName);
             }
             comboBoxAttField.SelectedIndex = FindAttFieldIndex();
             _controlPtsOK       = true;
             groupBoxBMs.Enabled = true;
             foreach (ListViewItem item in listViewData.Items)
             {
                 if (_nameComparer.Equal(controlPtsName, (IDatasetName)item.Tag))
                 {
                     item.SubItems[2].ForeColor = Color.Gray;
                 }
                 else
                 {
                     item.SubItems[2].ForeColor = Color.Blue;
                 }
             }
         }
         EnableTransform();
     }
     catch (Exception ex)
     {
         ShowError(ex.Message);
     }
 }