Beispiel #1
0
 public DockpaneGJView()
 {
     InitializeComponent();
     timer.Tick += new EventHandler(ClearMessageEventHandler);
     ActiveToolChangedEvent.Subscribe(onToolChanged);
     //Active Pane Check
     ActivePaneChangedEvent.Subscribe(onPaneChanged);
 }
        protected AttributeDockpaneViewModel()
        {
            // By default, WPF data bound collections must be modified on the thread where the bound WPF control was created.
            // This limitation becomes a problem when you want to fill the collection from a worker thread to produce a nice experience.
            // For example, a search result list should be gradually filled as more matches are found, without forcing the user to wait until the
            // whole search is complete.

            // To get around this limitation, WPF provides a static BindingOperations class that lets you establish an
            // association between a lock and a collection (e.g., ObservableCollection\<T>).
            // This association allows bound collections to be updated from threads outside the main GUI thread,
            // in a coordinated manner without generating the usual exception.

            // TODO: Step4: add synchronization for worker thread update
            BindingOperations.EnableCollectionSynchronization(_featureLayers, _lockFeaturelayers);

            // TODO: Step3: subscribe to events used to populate the dropdown list with feature layers
            //// subscribe to the map view changed event... that's when we update the list of feature layers
            ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged);
            // also when the pane is changing we will update the list of feature layers as well
            ActivePaneChangedEvent.Subscribe(OnActivePaneChanged);

            // TODO: Step5: fill the data grid with selected records - listen to the selection changed event
            //// subscribe to the selection changed event ... that's when we refresh our features
            MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged);

            // TODO: Step2: hook ArcGIS Pro Button
            var toolWrapper = FrameworkApplication.GetPlugInWrapper(DAML.Tool.esri_mapping_selectByRectangleTool);
            var toolCmd     = toolWrapper as ICommand; // tool and command(Button) supports this

            if (toolCmd != null)
            {
                SelectionTool = new RelayCommand(func => toolCmd.Execute(null),
                                                 func => toolCmd.CanExecute(null));
            }
            var closeWrapper = FrameworkApplication.GetPlugInWrapper(DAML.Button.esri_core_exitApplicationButton);
            var closeCmd     = closeWrapper as ICommand; // tool and command(Button) supports this

            if (closeCmd != null)
            {
                CloseCommand = new RelayCommand(func => closeCmd.Execute(null),
                                                func => closeCmd.CanExecute(null));
            }

            // in case the active pane is already up before we could subscribe to the changed event
            OnActivePaneChanged(null);
        }
        public HeadingViewModel()
        {
            MapView activeMapView = ProSDKSampleModule.ActiveMapView;

            if ((activeMapView != null))
            {
                _headingValue = activeMapView.Camera.Heading;
                _enableCamera = true;
            }
            else
            {
                _headingValue = 0;
                _enableCamera = false;
            }

            ViewerExtentChanged.Subscribe(CameraChanged);
            ActivePaneChangedEvent.Subscribe(OnActivePaneChanged);
        }
		protected CreateReportViewModel()
		{
			//subscribe to event, 
			//to refresh layers in map when active map changes
			ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged);
			//When a Map Pane is initialized
			ActivePaneChangedEvent.Subscribe(OnActivePaneChanged);
			//When a new report is created
			ArcGIS.Desktop.Core.Events.ProjectItemsChangedEvent.Subscribe(OnProjectItemsChanged);
			System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_layers, _lock);
			System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_reportTemplates, _reportTemplatesLock);
			System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_reportStyles, _reportStylesLock);
			if (MapView.Active == null)
				return;
			GetLayersInMap();
			_ = UpdateCollectionsAsync(); //Gets the template types and styles.
			_ = GetReportsInProjectAsync();			
		}