/// <summary> /// Called whenever the current feature changes /// </summary> protected override void OnFeatureChanged(EditableFeature oldFeature, EditableFeature newfeature) { base.OnFeatureChanged(oldFeature, newfeature); var feature = (newfeature != null) ? newfeature.Feature : null; //MessageBox.Show(feature.TableDescriptor.Name); if (feature.TableDescriptor.Name == "sheath_splice" || feature.TableDescriptor.Name == "sheath splice") { int indexID = feature.TableDescriptor.FieldDescriptors.IndexOf("id"); int indexName = feature.TableDescriptor.FieldDescriptors.IndexOf("name"); IdCaja = feature.Values.GetValue(indexID).ToString(); NombreCaja = feature.Values.GetValue(indexName).ToString(); Visibilidad = Visibility.Visible; } else { IdCaja = ""; NombreCaja = ""; Visibilidad = Visibility.Collapsed; } if (feature.TableDescriptor.Name.ToLower().Contains("cliente")) { int indexCuenta = feature.TableDescriptor.FieldDescriptors.IndexOf("cuenta"); try { CuentaCliente = feature.Values.GetValue(indexCuenta).ToString(); VisibilidadU2000 = Visibility.Visible; } catch { } } else { CuentaCliente = ""; VisibilidadU2000 = Visibility.Collapsed; } // Set up the Reports for the feature (well, for its collectionRecipe, // since a feature can be treated as a collectionRecipe as well) this.Reports.SetupFor(feature); if (!SettingFeatureFromHistory) { // Let's add the new feature to the history (if we're not actually setting the feature from a history-change). // Skip in case this is a trail feature this.History.Add(newfeature); } // With a new feature available, check the commands explicitly // Although the RunReport command checks itself, any additional // commands that might be added may need to be checked. CheckCommands(); }
/// <summary> /// Called whenever the current feature changes /// </summary> protected override void OnFeatureChanged(EditableFeature oldFeature, EditableFeature feature) { base.OnFeatureChanged(oldFeature, feature); try { //Obtener Campos para GSA TableName = feature.TableDescriptor.ExternalName; int totFields = feature.TableDescriptor.FieldDescriptors.Names().Count; ISInformativo = string.Empty; for (int i = 0; i < totFields; i++) { if (feature.Values.GetValue(i) != null) { ISInformativo = ISInformativo + feature.Values.GetValue(i).ToString() + '|'; } else { ISInformativo = ISInformativo + " " + '|'; } } ISFields = string.Empty; foreach (var i in feature.TableDescriptor.FieldDescriptors.Names()) { ISFields = ISFields + i.ToString() + '|'; } // Set up the Reports for the feature (well, for its collectionRecipe, // since a feature can be treated as a collectionRecipe as well) var features = (feature != null) ? feature.Feature : null; this.Reports.SetupFor(features); if (!SettingFeatureFromHistory) { // Let's add the new feature to the history (if we're not actually setting the feature from a history-change). // Skip in case this is a trail feature this.History.Add(feature); } // With a new feature available, check the commands explicitly // Although the RunReport command checks itself, any additional // commands that might be added may need to be checked. CheckCommands(); } catch { } }
/// <summary> /// Constructs the request /// </summary> /// <param name="sender">The originator of the request</param> /// <param name="feature">The feature (recipe-holder) to show details for</param> public LiteNewFeatureRequestMessage(Object sender, FeatureTableDescriptor tableDescriptor, FeatureGeometryFieldDescriptor geomDescriptor, IFeatureGeometry startWithGeometry = null, Feature attachToFeature = null) : base(sender) { this.TableDescriptor = tableDescriptor; this.GeometryDescriptor = geomDescriptor; if (tableDescriptor.EditabilityProperties.AllowInsert) { var newFeature = tableDescriptor.NewTemplateFeature(); if (geomDescriptor != null && startWithGeometry != null) { StartedWithTrail = true; newFeature[geomDescriptor.Name] = startWithGeometry; } Feature = new EditableFeature(newFeature, false, attachToFeature); } }
/// <summary> /// Handles the starting of editing geometry /// </summary> private void StartEditingGeometry(EditableFeature feature, FeatureGeometryFieldDescriptor fieldDescriptor) { // Get the mapView to interact upon var mapView = MapView; // Make sure we stop editing geometry first StopEditingGeometry(); if (mapView != null) { mapView.ClearSelection(); if (EditFeature != feature) { // A new feature; clear the model completely ClearModel(); } IsEditing = false; this.EditFeature = null; if (feature != null && MapView != null) { var geometry = feature[fieldDescriptor] as IFeatureGeometry; // Set the edit properties EditFeature = feature; IsEditing = true; // Now do the thing, dependent on availability of a geometry try { SettingUp = true; var redliningElement = ElementFor(fieldDescriptor, geometry); } finally { SettingUp = false; } } } }
/// <summary> /// Request editing the geometry /// </summary> public LiteStartEditGeometryRequestMessage(object sender, EditableFeature feature, FeatureGeometryFieldDescriptor field) : base(sender) { this.Feature = feature; this.FieldDescriptor = field; }