예제 #1
0
        protected override bool Initialize()
        {
            SetupLogging();

            FrameworkApplication.State.Deactivate(HasImplementationState);

            QueuedTask.Run(async() => {
                await CheckForLastest();

                Log.Debug("Initializing UIC Workflow Addin {version}", EvergreenSettings.CurrentVersion.AddInVersion);
            });

            if (MapView.Active == null)
            {
                _token = MapViewInitializedEvent.Subscribe(args => CacheLayers(args.MapView));
            }
            else
            {
                CacheLayers(MapView.Active);

                if (Layers.Count < 1 || Layers.Any(x => x.Value == null))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        private void UnsubscribeToEvents()
        {
            MapViewInitializedEvent.Unsubscribe(_mapOpenEvent);
            _mapOpenEvent = null;

            //MessageBox.Show("Unubscribed To Events", "MapFixer");
        }
 /// <summary>
 /// Called by Framework when ArcGIS Pro is closing
 /// </summary>
 /// <returns>False to prevent Pro from closing, otherwise True</returns>
 protected override bool CanUnload()
 {
     MapViewInitializedEvent.Unsubscribe(OnMapViewInitialized);
     MapMemberPropertiesChangedEvent.Unsubscribe(OnMapMemberPropertiesChanged);
     MapClosedEvent.Unsubscribe(OnMapClosed);
     //return false to ~cancel~ Application close
     return(true);
 }
        protected override async void Uninitialize()
        {
            await RemoveLayersAsync(true);

            MapViewInitializedEvent.Unsubscribe(OnMapViewInitialized);
            MapClosedEvent.Unsubscribe(OnMapClosedDocument);
            base.Uninitialize();
        }
 protected override bool Initialize()
 {
     //subscribe to events to determine if the procedural symbol dockpane should be visible.
     ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged);
     MapViewInitializedEvent.Subscribe(OnMapViewInitialized);
     MapMemberPropertiesChangedEvent.Subscribe(OnMapMemberPropertiesChanged);
     MapClosedEvent.Subscribe(OnMapClosed);
     return(base.Initialize());
 }
예제 #6
0
        private void SubscribeToEvents()
        {
            if (_mapOpenEvent == null)
            {
                _mapOpenEvent = MapViewInitializedEvent.Subscribe(CheckMap);
            }

            //MessageBox.Show("Subscribed To Events", "MapFixer");
        }
예제 #7
0
        /// <summary>
        /// Combo Box constructor
        /// </summary>
        public ComboBoxFeatureLayer()
        {
            mappa = ProAddInSR.funzioniVariabiliGlobali.FunzioniGlobali.RicavaMappaAttiva();
            UpdateCombo();

            MapViewInitializedEvent.Subscribe(OnMapViewCaricata); // Occurs when the map view has initialized --> Cioè aperta nuova Mappa, e caricata da zero!!
            LayersAddedEvent.Subscribe(EventoLayerInTOC);
            LayersMovedEvent.Subscribe(EventoLayerInTOC);
            LayersRemovedEvent.Subscribe(EventoLayerInTOC);
            MapClosedEvent.Subscribe(AllaChiusuraMappa);
            MapPropertyChangedEvent.Subscribe(AllaVariazioneProprietaMappa); // Occurs when any property of a map is changed.
            MapMemberPropertiesChangedEvent.Subscribe(EventoLayerInTOC);     // Occurs when any property of layer or standalone table changed.
        }
예제 #8
0
        public GlobeSpotter()
        {
            _agreement = Agreement.Instance;

            if (_agreement.Value)
            {
                FrameworkApplication.State.Activate("globeSpotterArcGISPro_agreementAcceptedState");
            }

            Login login = Login.Instance;

            login.Check();
            MapViewInitializedEvent.Subscribe(OnMapViewInitialized);
            MapClosedEvent.Subscribe(OnMapClosedDocument);
        }
        public StreetSmart()
        {
            _agreement = Agreement.Instance;
            _constantsRecordingLayer = ConstantsRecordingLayer.Instance;

            if (_agreement.Value)
            {
                FrameworkApplication.State.Activate("streetSmartArcGISPro_agreementAcceptedState");
            }

            Login login = Login.Instance;

            login.Check();
            MapViewInitializedEvent.Subscribe(OnMapViewInitialized);
            MapClosedEvent.Subscribe(OnMapClosedDocument);
        }
예제 #10
0
        public void CacheLayers(MapView view = null)
        {
            Log.Debug("Caching project layers");

            if (_token != null)
            {
                MapViewInitializedEvent.Unsubscribe(_token);
            }

            var activeView = MapView.Active ?? view;

            if (activeView == null)
            {
                Log.Debug("MapView is empty");

                return;
            }

            // Layers[FacilityModel.TableName] = LayerService.GetTable(FacilityModel.TableName, activeView.Map)
            //                                    as FeatureLayer;
        }
        private async Task DetectVectorLayersAsync(bool initEvents, MapView initMapView = null)
        {
            Clear();
            MapView mapView = initMapView ?? MapView.Active;
            Map     map     = mapView?.Map;
            IReadOnlyList <Layer> layers = map?.GetLayersAsFlattenedList();

            if (layers != null)
            {
                foreach (var layer in layers)
                {
                    await AddLayerAsync(layer);
                }
            }

            if (initEvents)
            {
                AddEvents();
                MapViewInitializedEvent.Subscribe(OnMapViewInitialized);
                MapClosedEvent.Subscribe(OnMapClosed);
            }
        }