Example #1
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            ESRI.ArcGIS.Framework.IMessageDialog msgBox = new ESRI.ArcGIS.Framework.MessageDialogClass();
            bool userResult = msgBox.DoModal("Closing", "When closing the tool you will lose your settings.", "Close", "Abort", ArcMap.Application.hWnd);

            if (userResult)
            {
                base.OnClosing(e);
                var viewmodel = (OWAToolViewModel)DataContext;
                viewmodel.ClosingCommand.Execute(null);
            }
            else
            {
                e.Cancel = true;
            }
        }
Example #2
0
        private void WireDocumentEvents()
        {
            //
            // TODO: Sample document event wiring code. Change as needed
            //

            // Named event handler
            ArcMap.Events.NewDocument += delegate() { ArcMap_NewDocument(); };

            // Anonymous event handler
            ArcMap.Events.BeforeCloseDocument += delegate()
            {
                // Return true to stop document from closing
                ESRI.ArcGIS.Framework.IMessageDialog msgBox = new ESRI.ArcGIS.Framework.MessageDialogClass();
                return(msgBox.DoModal("BeforeCloseDocument Event", "Abort closing?", "Yes", "No", ArcMap.Application.hWnd));
            };
        }
Example #3
0
        private void WireDocumentEvents()
        {
            //
            // TODO: Sample document event wiring code. Change as needed
            //

            // Named event handler
            ArcMap.Events.NewDocument += delegate() { ArcMap_NewDocument(); };

            // Anonymous event handler
            ArcMap.Events.BeforeCloseDocument += delegate()
            {
                // Return true to stop document from closing
                ESRI.ArcGIS.Framework.IMessageDialog msgBox = new ESRI.ArcGIS.Framework.MessageDialogClass();
                return msgBox.DoModal("BeforeCloseDocument Event", "Abort closing?", "Yes", "No", ArcMap.Application.hWnd);
            };
        }
Example #4
0
        protected override void DoLockCommand()
        {
            _isLocked = !_isLocked;

            if (!_isLocked && _isSendToInMemoryWorkspaceCommand)
            {
                ESRI.ArcGIS.Framework.IMessageDialog msgBox = new ESRI.ArcGIS.Framework.MessageDialogClass();
                bool userResult = msgBox.DoModal("Unlocking", "Unlocking also disconnects from the managed layer.", "Unlock", "Abort", ArcMap.Application.hWnd);

                //if the user hit no we have to set the lock state back to locked
                if (!userResult)
                {
                    _isLocked = !_isLocked;
                    return;
                }
                if (userResult)
                {
                    _isSendToInMemoryWorkspaceCommand = !_isSendToInMemoryWorkspaceCommand;
                    _mcdaExtension.RemoveLink(_wlcTool);
                    this.SelectedFeaturePropertyChanged(this, null);

                    PropertyChanged.Notify(() => IsSendToInMemoryWorkspaceCommand);
                }
            }

            if (_isLocked)
            {
                //ProgressDialog.ShowProgressDialog("Creating In Memory Representation",
                //    (Action<AbstractToolTemplate>)_mcdaExtension.EstablishLink, _wlcTool);

                ProgressDialogBuilder progressDialogBuilder = new ProgressDialogBuilder((Action <AbstractToolTemplate>)_mcdaExtension.EstablishLink, _wlcTool);
                progressDialogBuilder.SetTitle("Creating In Memory Representation").SetHideCancelButton(true).SetIsIndeterminate(true).Build().Show();
            }

            if (!_isLocked && !_isSendToInMemoryWorkspaceCommand)
            {
                _mcdaExtension.RemoveLink(_wlcTool);
                this.SelectedFeaturePropertyChanged(this, null);
            }

            PropertyChanged.Notify(() => IsLocked);
        }
Example #5
0
        protected override void DoLockCommand()
        {
            _isLocked = !_isLocked;

            if (!_isLocked && _isSendToInMemoryWorkspaceCommand)
            {
                ESRI.ArcGIS.Framework.IMessageDialog msgBox = new ESRI.ArcGIS.Framework.MessageDialogClass();
                var userResult = msgBox.DoModal("Unlocking", "Unlocking also disconnects from the managed layer.", "Unlock", "Abort", ArcMap.Application.hWnd);

                //if the user hit no we have to set the lock state back to locked
                if (!userResult)
                {
                    _isLocked = !_isLocked;
                    return;
                }
                if (userResult)
                {
                    _isSendToInMemoryWorkspaceCommand = !_isSendToInMemoryWorkspaceCommand;
                    _mcdaExtension.RemoveLink(_lwlcTool);
                    this.SelectedFeaturePropertyChanged(this, null);

                    PropertyChanged.Notify(() => IsSendToInMemoryWorkspaceCommand);
                }
            }

            if (_isLocked)
            {
                ProgressDialog.ShowProgressDialog("Creating In Memory Representation", (Action <AbstractToolTemplate>)_mcdaExtension.EstablishLink, _lwlcTool);
                // the lwlc depends on the featureClass data, thus we have to make sure that we work on the featureClass of the in memory workspace
                _lwlcTool.FeatureClass = _mcdaExtension.LinkDictionary[_lwlcTool].FeatureClass;
            }

            if (!_isLocked && !_isSendToInMemoryWorkspaceCommand)
            {
                _mcdaExtension.RemoveLink(_lwlcTool);
                this.SelectedFeaturePropertyChanged(this, null);
            }

            PropertyChanged.Notify(() => IsLocked);
        }