ArcGISCompare.frmMaster.tcTop_Selecting C# (CSharp) Метод

tcTop_Selecting() приватный Метод

private tcTop_Selecting ( object sender, TabControlCancelEventArgs e ) : void
sender object
e TabControlCancelEventArgs
Результат void
        void tcTop_Selecting(object sender, TabControlCancelEventArgs e)
        {
            int ACount = 0;
            ICodedValueDomain theEnum;
            String theVal = "";

            if (tcTop.SelectedTab == tabPage2) // selected page is Attribute Mapping Page
            {
            }
            else if (tcTop.SelectedTab == tabPage3)  // Selected Page is Value Mapping Page
            {
                if (lstAttMappings.SelectedIndex >= 0)
                {
                    lbSourceValues.Items.Clear();
                    lbDestinationValues.Items.Clear();
                    Boolean hasValue = false;

                    AttributeMappingData theItem = (AttributeMappingData)lstAttMappings.SelectedItem;
                    if (theItem.destEnum != null)
                    {
                        IFeatureClass theFC = GeoDbProcs.GetFeatureClass(srcWrkSpc, theItem.srcFC);

                        IQueryFilter theQF = new QueryFilterClass();
                        theQF.WhereClause = theItem.srcAtt + " IS NOT NULL";

                        lbSourceValues.Items.Clear();
                        IFeatureCursor theCur = theFC.Search(theQF, false);
                        IFeature theF = theCur.NextFeature();

                        int theIndex = theFC.Fields.FindField(theItem.srcAtt);

                        while (theF != null)
                        {
                            switch (theItem.srcDT)
                            {
                                case esriFieldType.esriFieldTypeString:
                                    theVal = theF.get_Value(theIndex).ToString();

                                    if (lbSourceValues.Items.Count > 0)
                                    {
                                        for (int v = 0; v < lbSourceValues.Items.Count; v++)
                                            if (lbSourceValues.Items[v].ToString() == theVal) { hasValue = true; }

                                        if (hasValue != true) { lbSourceValues.Items.Add(new ValueData(theVal, theVal, "None")); }
                                    }
                                    else { lbSourceValues.Items.Add(new ValueData(theVal, theVal, "None")); }
                                    break;
                                default:
                                    break;
                            }
                            theF = theCur.NextFeature();
                        }
                    }
                    theEnum = GeoDbProcs.GetFieldEnumeration(destWrkSpc, "Implementation", theItem);

                    if (theEnum != null)
                    {
                        for (int i = 0; i < theEnum.CodeCount; i++)
                        { lbDestinationValues.Items.Add(new ValueData(theEnum.get_Name(i).ToString(), theEnum.get_Value(i).ToString(), theItem.destEnum)); }
                    }

                    lstValueMappings.Items.Clear();
                    if (theItem.theConversions != null)
                    {
                        foreach (ValueMappingData theDMap in theItem.theConversions)
                        {
                            lstValueMappings.Items.Add(theDMap);
                            ValueData theA = getValueListBoxItem(lbSourceValues, theDMap.srcV);
                            if (theA != null) { theA.numMappings += 1; }

                            theA = getValueListBoxItem(lbDestinationValues, theDMap.destV);
                            if (theA != null) { theA.numMappings += 1; }

                            this.Refresh();
                            Application.DoEvents();
                        }
                    }
                }
            }
            else  // Selected Page is Feature Mapping Page
            {
                tcTop.TabPages.Remove(tabPage3);
                tcTop.TabPages.Remove(tabPage2);
                theMap = null;
            }
        }