Пример #1
0
 public void LoadUI_SerialPort()
 {
     if (!MRhinoDockBarManager.IsDockBarVisible(UIContiner_serialport.DockBarID))
     {
         MRhinoDockBarManager.ShowDockBar(UIContiner_serialport.DockBarID, true, true);
     }
 }
Пример #2
0
 public void LoadUI()
 {
     Rhino.RhinoApp.WriteLine("Add UI");
     if (!MRhinoDockBarManager.IsDockBarVisible(UIContiner.DockBarID))
     {
         MRhinoDockBarManager.ShowDockBar(UIContiner.DockBarID, true, true);
     }
 }
        ///<summary> This gets called when when the user runs this command.</summary>
        public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
        {
            Guid id       = SampleCsObjectManagerDockBar.ID();
            bool bVisible = 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)
                {
                    MRhinoDockBarManager.ShowDockBar(id, false, false);
                }
            }
            else if (s_option == option_index)
            {
                if (!bVisible)
                {
                    MRhinoDockBarManager.ShowDockBar(id, true, false);
                }
            }
            else if (t_option == option_index)
            {
                if (bVisible)
                {
                    MRhinoDockBarManager.ShowDockBar(id, false, false);
                }
                else
                {
                    MRhinoDockBarManager.ShowDockBar(id, true, false);
                }
            }

            return(IRhinoCommand.result.success);
        }