Inheritance: PropertyChangedBase, IComparable
コード例 #1
0
        public int CompareTo(object obj)
        {
            DomainCodedValuePair a = this;
            DomainCodedValuePair b = (DomainCodedValuePair)obj;

            return(string.Compare(a.Name, b.Name));
        }
コード例 #2
0
        private void GetDomainAndPopulateList(IReadOnlyList <Field> fields, string fieldName, ObservableCollection <DomainCodedValuePair> memberCodedValueDomains, bool orderbyName = false)
        {
            ArcGIS.Core.Data.Field foundField = fields.FirstOrDefault(field => field.Name == fieldName);

            //Clear out any old values
            memberCodedValueDomains.Clear();

            if (foundField != null)
            {
                Domain domain           = foundField.GetDomain();
                var    codedValueDomain = domain as CodedValueDomain;
                if (codedValueDomain != null)
                {
                    SortedList <object, string> codedValuePairs = codedValueDomain.GetCodedValuePairs();

                    foreach (KeyValuePair <object, string> pair in codedValuePairs)
                    {
                        DomainCodedValuePair domainObjectPair = new DomainCodedValuePair(pair.Key, pair.Value);
                        memberCodedValueDomains.Add(domainObjectPair);
                    }

                    if (orderbyName)
                    {
                        //Order the collection alphabetically by the names, rather than the default by the code
                        memberCodedValueDomains.Sort();
                    }
                }
            }
        }
        private void GetDomainAndPopulateList(IReadOnlyList <Field> fields, string fieldName, ObservableCollection <DomainCodedValuePair> memberCodedValueDomains)//SortedList<object, string> memberCodedValueDomains)
        {
            ArcGIS.Core.Data.Field foundField = fields.FirstOrDefault(field => field.Name == fieldName);

            //Clear out any old values
            memberCodedValueDomains.Clear();

            if (foundField != null)
            {
                Domain domain           = foundField.GetDomain();
                var    codedValueDomain = domain as CodedValueDomain;
                SortedList <object, string> codedValuePairs = codedValueDomain.GetCodedValuePairs();

                foreach (KeyValuePair <object, string> pair in codedValuePairs)
                {
                    DomainCodedValuePair domainObjectPair = new DomainCodedValuePair(pair.Key, pair.Value);
                    memberCodedValueDomains.Add(domainObjectPair);//pair.Value);
                }
            }
        }
        private void GetDomainAndPopulateList(IReadOnlyList<Field> fields, string fieldName, ObservableCollection<DomainCodedValuePair> memberCodedValueDomains, bool orderbyName = false)
        {
            ArcGIS.Core.Data.Field foundField = fields.FirstOrDefault(field => field.Name == fieldName);

            //Clear out any old values
            memberCodedValueDomains.Clear();

            if (foundField != null)
            {
                Domain domain = foundField.GetDomain();
                var codedValueDomain = domain as CodedValueDomain;
                SortedList<object, string> codedValuePairs = codedValueDomain.GetCodedValuePairs();

                foreach (KeyValuePair<object, string> pair in codedValuePairs)
                {
                    DomainCodedValuePair domainObjectPair = new DomainCodedValuePair(pair.Key, pair.Value);
                    memberCodedValueDomains.Add(domainObjectPair);
                }

                if (orderbyName)
                {
                    //Order the collection alphabetically by the names, rather than the default by the code
                    memberCodedValueDomains.Sort();
                }
            }
        }
コード例 #5
0
        private void GetDomainAndPopulateList(IReadOnlyList <Field> fields, string fieldName, ObservableCollection <DomainCodedValuePair> memberCodedValueDomains, bool orderbyName = false)
        {
            ArcGIS.Core.Data.Field foundField = fields.FirstOrDefault(field => field.Name == fieldName);

            //Clear out any old values
            memberCodedValueDomains.Clear();

            if (foundField != null)
            {
                Domain domain = foundField.GetDomain();

                var codedValueDomain = domain as CodedValueDomain;
                if (codedValueDomain != null)
                {
                    SortedList <object, string> codedValuePairs = codedValueDomain.GetCodedValuePairs();

                    foreach (KeyValuePair <object, string> pair in codedValuePairs)
                    {
                        DomainCodedValuePair domainObjectPair = new DomainCodedValuePair(pair.Key, pair.Value);
                        memberCodedValueDomains.Add(domainObjectPair);
                    }

                    if (orderbyName)
                    {
                        //Order the collection alphabetically by the names, rather than the default by the code
                        memberCodedValueDomains.Sort();
                    }

                    // Minor hack to make USA appear first in the list
                    if (fieldName == "countrycode")
                    {
                        // TRICKY: Domains have 3 different formats, old format: "USA" and new format: "US" "840"
                        // Check the format of the domains to see which format we should use
                        DomainCodedValuePair testDomainPair = memberCodedValueDomains[0];
                        object code = testDomainPair.Code;

                        DomainCodedValuePair usaDomainObjectPair = null;

                        if (code is int)
                        {
                            // New Format
                            usaDomainObjectPair = new DomainCodedValuePair(840, "United States"); // new format, 2525D/APP6D
                        }
                        else if (code is string)
                        {
                            string testString = code as string;
                            if (testString.Length == 2)
                            {
                                usaDomainObjectPair = new DomainCodedValuePair("US", "United States"); // new format, 2525B/C/APP6B
                            }
                            else
                            {
                                usaDomainObjectPair = new DomainCodedValuePair("USA", "United States"); // old format
                            }
                        }

                        if (usaDomainObjectPair != null)
                        {
                            memberCodedValueDomains.Insert(0, usaDomainObjectPair);
                        }
                    }

                    // Add a "<null>" value to the domain list - so this field can be cleared with this flag
                    // but skip ones that will cause problems with the addin
                    if (!((fieldName == "identity") || (fieldName == "affiliation") ||
                          (fieldName == "extendedfunctioncode") || (fieldName == "symbolentity")))
                    {
                        memberCodedValueDomains.Add(new DomainCodedValuePair(ProSymbolUtilities.NullFieldValueFlag,
                                                                             ProSymbolUtilities.NullFieldValueFlag));
                    }
                }
            }
        }