2

With the Help of https://developers.arcgis.com/silverlight/sample-code/start.htm#FeatureLayerSelection

I have a Editor in xaml & I bind the same Editor Object to My ViewModel by little tweak in map.xaml.cs

This editor is defined in same way link have defined. Now at ViewModel I am working with EditComplete. In this method I have a Aggrigator Publishing. and I m subscribing in other ViewModel

when User select the geometries in map OnEditCompleteFLayer method defiend in ViewModel is Running 2 times 1st It runs with selected Graphics Next time it have 0 Graphics in it?

can anyone Guide me why this InternalPublish is happening and why this Editor.ONEditCompleted Running 2 times? How to resolve it.

map.xaml.cs constructor.

 public HpmsBaseEsriMap()
    {
        InitializeComponent();
        if (DesignerProperties.IsInDesignTool == false)
        {
            var dmv = ServiceLocator.Current.GetInstance<IHpmsBaseEsriMapViewModel>();
            dmv.HpmEditor = this.HpmsRoutesSelectionEditorNme;
            dmv.BindingMap();
            DataContext = dmv;
        }
    }

ViewModel

public void BindingMap()
    {
        HpmEditor.EditCompleted += OnEditCompleteFLayer;          
    }
 private void OnEditCompleteFLayer(object sender, Editor.EditEventArgs e)
    {
        var edtr = sender as Editor;
        GraphicsLayer gl= edtr.GraphicsLayers.FirstOrDefault();
        GraphicCollection gCol = gl.Graphics;
        List<string> routeids = (e.Edits.Select(g=>g.Graphic).Select(x => x.Attributes).Where(d => d.Keys.Contains("ROUTE_ID"))).Select(p => p["ROUTE_ID"].ToString()).ToList();
        Routeids = routeids;
        _aggregator.GetEvent<RouteSelectionMapEvent>().Publish(Routeids);
        InfoWindow inf = new InfoWindow();
        string msg = gCol.Count + "-- TOTAL Selection";
        inf.Content = msg;
        var ev = e;
    }

Output Window Log

   Step into: Stepping over non-user code    'Microsoft.Practices.Prism.Events.EventSubscription<System.Collections.Generic.List<string>>.InvokeAction'
   Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.EventSubscription<System.Collections.Generic.List<string>>.GetExecutionStrategy.AnonymousMethod__0'
   Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.EventBase.InternalPublish'
    Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.CompositePresentationEvent<System.Collections.Generic.List<string>>.Publish'
    The thread '<No Name>' (0x2f80) has exited with code 0 (0x0).
    Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.OnEditCompleted'
    Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.OnSelect.AnonymousMethod__3d'
   Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.EventSubscription<System.Collections.Generic.List<string>>.InvokeAction'
   Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.EventSubscription<System.Collections.Generic.List<string>>.GetExecutionStrategy.AnonymousMethod__0'
    Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.EventBase.InternalPublish'
    Step into: Stepping over non-user code 'Microsoft.Practices.Prism.Events.CompositePresentationEvent<System.Collections.Generic.List<string>>.Publish'
     The thread 0x292c has exited with code 259 (0x103).
     The thread 0x2f04 has exited with code 259 (0x103).
     The thread 0x2434 has exited with code 259 (0x103).
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.OnEditCompleted'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.OnEditCompleted'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.CancelActiveAction'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.OnSelect'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.DelegateCommand.Execute'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.Editor.OnSelect.AnonymousMethod__3d'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.FeatureService.Editing.SpatialSelect.OnSpatialSelectCompleted'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.FeatureService.Editing.SpatialSelect.executeSpatialSelect'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.FeatureService.Editing.SpatialSelect.DrawCompleted'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.FeatureService.Editing.SpatialSelect.drawSelection_SelectionCompleted'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.DrawSelection.Select'
  Step into: Stepping over non-user code 'ESRI.ArcGIS.Client.DrawSelection.Map_MouseLeftButtonUp'
  Step into: Stepping over non-user code 'MS.Internal.CoreInvokeHandler.InvokeEventHandler'
  Step into: Stepping over non-user code 'MS.Internal.JoltHelper.FireEvent'
  The thread 0x2134 has exited with code 259 (0x103).
1
  • I checked in e.Action is first time Select or Add ,ClearSelection in second run it comes to clear.
    – akirti
    Commented Oct 30, 2014 at 18:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.