protected override void OnClick()
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("RS_Tools_Tools_Inspector_InspectorSettings");
            var            command = wrapper as ICommand;

            InspectorSettingsViewModel.Show();
        }
        internal ElementCreationToolGalleryItem(string id, string group, IPlugInWrapper plugin, string name)
        {
            CommandID     = id;
            PlugInWrapper = plugin;
            if (PlugInWrapper.LargeImage is ImageSource)
            {
                Icon32 = (ImageSource)PlugInWrapper.LargeImage;
            }
            else
            {
                Icon32 = PlugInWrapper.LargeImage;
            }
            Group = group;
            Name  = name;
            switch (Group)
            {
            case "Point Tools":
                ToolShapeType = Module1.ToolType.Point;
                break;

            case "Line Tools":
                ToolShapeType = Module1.ToolType.Line;
                break;

            case "Polygon Tools":
                ToolShapeType = Module1.ToolType.Polygon;
                break;

            case "Text Tools":
                ToolShapeType = Module1.ToolType.Text;
                break;
            }
        }
Esempio n. 3
0
        private void btnPointer_Click(object sender, RoutedEventArgs e)
        {
            IPlugInWrapper piw   = FrameworkApplication.GetPlugInWrapper("GetJSON_PointerTool");
            ICommand       myCmd = piw as ICommand;

            if (myCmd != null)
            {
                if (piw.Enabled)
                {
                    if (myCmd.CanExecute(null))
                    {
                        myCmd.Execute(null);
                    }
                }
                else if (FrameworkApplication.GetPlugInWrapper("GetJSON_PointerTool").Enabled)
                {
                    if (myCmd.CanExecute(null))
                    {
                        myCmd.Execute(null);
                    }
                }
                else
                {
                    if (myCmd.CanExecute(null))
                    {
                        myCmd.Execute(null);
                    }
                }
            }
        }
        async protected override void OnClick()
        {
            Globals.mf_Name   = "";
            Globals.i_correct = 0;
            Globals.i_guesses = 0;
            Globals.selEvents = false;
            Globals.elmType   = "MF";

            LayoutProjectItem layoutItem = Project.Current.GetItems <LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals("Game Board"));

            if (layoutItem == null)
            {
                return;
            }
            await QueuedTask.Run(() => Project.Current.RemoveItem(layoutItem));

            await ProApp.Current.Dispatcher.BeginInvoke((Action)(() =>
            {
                FrameworkApplication.SetCurrentToolAsync("esri_mapping_selectByRectangleTool");
            }));

            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("Puzzle_2_1_CreateGameBoard");
            var            command = wrapper as ICommand; // tool and command(Button) supports this

            if ((command != null) && command.CanExecute(null))
            {
                command.Execute(null);
            }
        }
 private void GetButtonTooltipHeading()
 {
     #region Get a button's tooltip heading
     //Pass in the daml id of your button. Or pass in any Pro button ID.
     IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("button_id_from daml");
     var            buttonTooltipHeading = wrapper.TooltipHeading;
     #endregion
 }
        internal static void OnCustomButtonClick()
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("ProAppModule1_Button1");

            wrapper.Caption = "New Caption";
            wrapper.Tooltip = "New Tooltip";
            //TODO - something on click...
        }
        protected override void OnClick()
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_editing_ShowAttributes");
            var            command = wrapper as ICommand; // tool and command(Button) supports this

            if ((command != null) && command.CanExecute(null))
            {
                command.Execute(null);
            }
        }
Esempio n. 8
0
        public static void ModifyAddMapToDisplayCustomItem()
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_mapping_addDataButton");
            var            command = wrapper as ICommand;

            if ((command != null) && command.CanExecute(null))
            {
                command.Execute(null);
            }
        }
        protected override bool Initialize()
        {
            IPlugInWrapper Create_Button = FrameworkApplication.GetPlugInWrapper("MapPuzzleCreateGameBoard");

            IPlugInWrapper Scramble_Button = FrameworkApplication.GetPlugInWrapper("MapPuzzleScramblePieces");
            //Scramble_Button.Enabled = false
            IPlugInWrapper Play_Button = FrameworkApplication.GetPlugInWrapper("MapPuzzlePlayGame");
            IPlugInWrapper New_Button  = FrameworkApplication.GetPlugInWrapper("MapPuzzleNewGame");

            base.Initialize();
            ArcGIS.Desktop.Layouts.Events.ElementEvent.Subscribe(LayoutSelectionCallBack);
            return(true);
        }
Esempio n. 10
0
        protected override bool Initialize()
        {
            IPlugInWrapper Create_Button = FrameworkApplication.GetPlugInWrapper("Puzzle_2_1_CreateGameBoard");

            IPlugInWrapper Scramble_Button = FrameworkApplication.GetPlugInWrapper("Puzzle_2_1_ScramblePieces");
            //Scramble_Button.Enabled = false
            IPlugInWrapper Play_Button = FrameworkApplication.GetPlugInWrapper("Puzzle_2_1_PlayGame");
            IPlugInWrapper New_Button  = FrameworkApplication.GetPlugInWrapper("Puzzle_2_1_NewGame");

            base.Initialize();
            LayoutSelectionChangedEvent.Subscribe(LayoutSelectionCallBack);
            return(true);
        }
 internal AcmeGalleryItem(string id, string group, IPlugInWrapper plugin)
 {
     CommandID     = id;
     PlugInWrapper = plugin;
     if (PlugInWrapper.LargeImage is ImageSource)
     {
         Icon32 = (ImageSource)PlugInWrapper.LargeImage;
     }
     else
     {
         Icon32 = PlugInWrapper.LargeImage;
     }
     Group = group;
 }
Esempio n. 12
0
        private void ChangeCaptionImage()
        {
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("MyAddin_MyCustomButton");

            if (wrapper != null)
            {
                wrapper.Caption = "new caption";

                // ensure that T-Rex16 and T-Rex32 are included in your add-in under the images folder and have
                // BuildAction = Resource and Copy to OutputDirectory = Do not copy
                wrapper.SmallImage = BuildImage("T-Rex16.png");
                wrapper.LargeImage = BuildImage("T-Rex32.png");
            }
        }
Esempio n. 13
0
 internal GraphicsElementToolItem(string id, string group, IPlugInWrapper plugin)
 {
     CommandID     = id;
     PlugInWrapper = plugin;
     if (PlugInWrapper.LargeImage is ImageSource)
     {
         Icon32 = (ImageSource)PlugInWrapper.LargeImage;
     }
     else
     {
         Icon32 = PlugInWrapper.LargeImage;
     }
     Group = group;
 }
Esempio n. 14
0
        /// <summary>
        /// Implement your custom filtering logic here. OnCommandExecute is called every time
        /// a command is clicked on the UI.
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        protected override bool OnCommandToExecute(string ID)
        {
            if (!_filter)
            {
                return(true);
            }

            //have we recorded this one?
            CommandFilterItem cmdFilterItem = _clickedCommands.FirstOrDefault(cfi => cfi.Id == ID);

            if (cmdFilterItem == null)
            {
                //no, we have not recorded this
                cmdFilterItem = new CommandFilterItem();
                IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(ID, false);
                if (wrapper.LargeImage != null)
                {
                    ImageSource img = wrapper.LargeImage as ImageSource;
                    cmdFilterItem.Thumbnail = img as BitmapImage;
                }
                cmdFilterItem.Caption    = wrapper.Caption;
                cmdFilterItem.Tooltip    = wrapper.Tooltip ?? "";
                cmdFilterItem.Id         = ID;
                cmdFilterItem.ClickCount = 1;
                _clickedCommands.Add(cmdFilterItem);
            }
            else
            {
                cmdFilterItem.ClickCount += 1;
            }

            if (_popMessageBox)
            {
                MessageBox.Show(string.Format("{0} is filtered. Cannot be executed", cmdFilterItem.Caption),
                                "Command Filter");
            }
            return(false); // returning false blocks command
        }
Esempio n. 15
0
        public void Snippets()
        {
            #region Execute a command
            IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_editing_ShowAttributes");
            var            command = wrapper as ICommand; // tool and command(Button) supports this

            if ((command != null) && command.CanExecute(null))
            {
                command.Execute(null);
            }

            #endregion

            #region Set the current tool

            // use SetCurrentToolAsync
            FrameworkApplication.SetCurrentToolAsync("esri_mapping_selectByRectangleTool");

            // or use ICommand.Execute
            ICommand cmd = FrameworkApplication.GetPlugInWrapper("esri_mapping_selectByRectangleTool") as ICommand;
            if ((cmd != null) && cmd.CanExecute(null))
            {
                cmd.Execute(null);
            }
            #endregion

            #region Activate a tab
            FrameworkApplication.ActivateTab("esri_mapping_insertTab");
            #endregion

            bool activate = true;
            #region Activate/Deactivate a state - to modify a condition

            // Define the condition in the DAML file based on the state
            if (activate)
            {
                FrameworkApplication.State.Activate("someState");
            }
            else
            {
                FrameworkApplication.State.Deactivate("someState");
            }
            #endregion

            #region Determine if the application is busy

            // The application is considered busy if a task is currently running on the main worker thread or any
            // pane or dock pane reports that it is busy or intiializing.

            // Many Pro styles (such as Esri_SimpleButton) ensure that a button is disabled when FrameworkApplication.IsBusy is true
            // You would use this property to bind to the IsEnabled property of a control (such as a listbox) on a dockpane or pane in order
            // to disable it from user interaction while the application is busy.
            bool isbusy = FrameworkApplication.IsBusy;
            #endregion

            #region Get the Application main window
            System.Windows.Window window = FrameworkApplication.Current.MainWindow;

            // center it
            Rect rect = System.Windows.SystemParameters.WorkArea;
            FrameworkApplication.Current.MainWindow.Left = rect.Left + (rect.Width - FrameworkApplication.Current.MainWindow.ActualWidth) / 2;
            FrameworkApplication.Current.MainWindow.Top  = rect.Top + (rect.Height - FrameworkApplication.Current.MainWindow.ActualHeight) / 2;

            #endregion

            #region Close ArcGIS Pro
            FrameworkApplication.Close();
            #endregion

            #region Get ArcGIS Pro version
            //"GetEntryAssembly" should be ArcGISPro.exe
            string version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
            #endregion
            #region Close a specific pane

            string _viewPaneID = "my pane"; //DAML ID of your pane
            //You could have multiple instances (InstanceIDs) of your pane.
            //So you can iterate through the Panes to get "your" panes only
            IList <uint> myPaneInstanceIDs = new List <uint>();
            foreach (Pane pane in FrameworkApplication.Panes)
            {
                if (pane.ContentID == _viewPaneID)
                {
                    myPaneInstanceIDs.Add(pane.InstanceID); //InstanceID of your pane, could be multiple, so build the collection
                }
            }
            foreach (var instanceID in myPaneInstanceIDs) //close each of "your" panes.
            {
                FrameworkApplication.Panes.ClosePane(instanceID);
            }
            #endregion

            #region Activate a pane
            var mapPanes = ProApp.Panes.OfType <IMapPane>();
            foreach (Pane pane in mapPanes)
            {
                if (pane.Caption == "MyMap")
                {
                    pane.Activate();
                    break;
                }
            }
            #endregion
        }
 public TaggedGalleryItem(IPlugInWrapper command, string text, object icon = null, string tooltip = "", string group = "")
     : base(text, icon, tooltip, group)
 {
     Command = command;
 }