Ejemplo n.º 1
0
        public async void setDomainValuesLayer(string dataset, string fieldName, string sourceTarget, bool resetUI)
        {
            List <ComboData> domain = new List <ComboData>();
            await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
            {
                try
                {
                    var lyr             = Helpers.CreateFeatureLayer(new Uri(dataset), MapView.Active.Map);
                    FeatureLayer flayer = lyr as FeatureLayer;
                    ArcGIS.Core.Data.TableDefinition def  = null;
                    ArcGIS.Core.CIM.CIMDataConnection cim = flayer.GetDataConnection();
                    FeatureClass fclass = flayer.GetFeatureClass();
                    def    = fclass.GetDefinition();
                    domain = getDomainValuesforTable(def, fieldName);
                }
                catch { raiseDomainErrorMessage(dataset, fieldName); }
                return;
            });

            if (resetUI == true)
            {
                resetDomainValuesUI(domain, sourceTarget);
            }
            else
            {
                resetDomainValuesUIFromConfig(domain, sourceTarget);
            }
            return;
        }
Ejemplo n.º 2
0
        public async void setDomainValuesFile(string db, string dataset, string fieldName, string sourceTarget, bool resetUI)
        {
            List <ComboData> domain = new List <ComboData>();
            await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
            {
                ArcGIS.Core.Data.TableDefinition def = null;
                try
                {
                    string table = dataset.Substring(dataset.LastIndexOf("\\") + 1);
                    ArcGIS.Core.Data.Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(db)));
                    using (ArcGIS.Core.Data.Table tab = geodatabase.OpenDataset <ArcGIS.Core.Data.Table>(table))
                    {
                        def    = tab.GetDefinition();
                        domain = getDomainValuesforTable(def, fieldName);
                    }
                }
                catch { raiseDomainErrorMessage(dataset, fieldName); }
                return;
            });

            if (resetUI == true)
            {
                resetDomainValuesUI(domain, sourceTarget);
            }
            else
            {
                resetDomainValuesUIFromConfig(domain, sourceTarget);
            }
            return;
        }