private Task ShowAttributes() { return(QueuedTask.Run(() => { try { _fieldAttributes.Clear(); if (SelectedLayer == null || SelectedOID == null) { return; } var oidField = SelectedLayer.GetTable().GetDefinition().GetObjectIDField(); var qf = new ArcGIS.Core.Data.QueryFilter() { WhereClause = string.Format("{0} = {1}", oidField, SelectedOID) }; var cursor = SelectedLayer.Search(qf); Row row = null; if (cursor.MoveNext()) { row = cursor.Current; } if (row == null) { return; } var fields = row.GetFields(); lock (_lock) { foreach (ArcGIS.Core.Data.Field field in fields) { if (field.FieldType == FieldType.Geometry) { continue; } var val = row[field.Name]; FieldAttributeInfo fa = new FieldAttributeInfo(field, (val is DBNull || val == null) ? null : val.ToString()); _fieldAttributes.Add(fa); } } } catch (Exception) { } })); }
internal bool ValidateExpresion(bool showValidationSuccessMsg) { try { var qf = new QueryFilter() { WhereClause = WhereClause }; SelectedLayer.Search(qf); } catch (Exception) { HasError = true; IsValid = false; return(false); } if (showValidationSuccessMsg) { IsValid = true; } HasError = false; return(true); }