ID() public static method

Dockbar Id
public static ID ( ) : System.Guid
return System.Guid
Ejemplo n.º 1
0
        ///<summary>
        /// Called after the plug-in is loaded and the constructor has been run.
        /// This is a good place to perform any significant initialization,
        /// license checking, and so on.  This function must return 1 for
        /// the plug-in to continue to load.
        ///</summary>
        ///<returns>
        ///  1 = initialization succeeded, let the plug-in load
        ///  0 = unable to initialize, don't load plug-in and display an error dialog
        /// -1 = unable to initialize, don't load plug-in and do not display an error
        ///      dialog. Note: OnUnloadPlugIn will not be called
        ///</returns>
        public override int OnLoadPlugIn()
        {
            _control = new SampleCsDockingDialogUserControl();
            _dockbar = new RMA.UI.MRhinoUiDockBar(SampleCsDockingDialogDockBar.ID(), PlugInName(), _control);
            RMA.UI.MRhinoDockBarManager.CreateRhinoDockBar(this, _dockbar, false);

            return(1);
        }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            System.Guid id       = SampleCsDockingDialogDockBar.ID();
            bool        bVisible = RMA.UI.MRhinoDockBarManager.IsDockBarVisible(id);

            string prompt;

            if (bVisible)
            {
                prompt = string.Format("{0} window is visible. New value", EnglishCommandName());
            }
            else
            {
                prompt = string.Format("{0} window is hidden. New value", EnglishCommandName());
            }

            MRhinoGetOption go = new MRhinoGetOption();

            go.SetCommandPrompt(prompt);
            int h_option = go.AddCommandOption(new MRhinoCommandOptionName("Hide"));
            int s_option = go.AddCommandOption(new MRhinoCommandOptionName("Show"));
            int t_option = go.AddCommandOption(new MRhinoCommandOptionName("Toggle"));

            go.GetOption();
            if (go.CommandResult() != IRhinoCommand.result.success)
            {
                return(go.CommandResult());
            }

            IRhinoCommandOption opt = go.Option();

            if (opt == null)
            {
                return(IRhinoCommand.result.failure);
            }

            int option_index = opt.m_option_index;

            if (h_option == option_index)
            {
                if (bVisible)
                {
                    RMA.UI.MRhinoDockBarManager.ShowDockBar(id, false, false);
                }
            }
            else if (s_option == option_index)
            {
                if (!bVisible)
                {
                    RMA.UI.MRhinoDockBarManager.ShowDockBar(id, true, false);
                }
            }
            else if (t_option == option_index)
            {
                if (bVisible)
                {
                    RMA.UI.MRhinoDockBarManager.ShowDockBar(id, false, false);
                }
                else
                {
                    RMA.UI.MRhinoDockBarManager.ShowDockBar(id, true, false);
                }
            }

            return(IRhinoCommand.result.success);
        }