Beispiel #1
0
        protected override Rhino.Commands.Result RunCommand(Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode)
        {
            System.Guid panelId  = SampleCsPanelUserControl.PanelId;
            bool        bVisible = Rhino.UI.Panels.IsPanelVisible(panelId);

            string prompt = (bVisible)
        ? "Sample panel is visible. New value"
        : "Sample Manager panel is hidden. New value";

            Rhino.Input.Custom.GetOption go = new Rhino.Input.Custom.GetOption();
            int hide_index   = go.AddOption("Hide");
            int show_index   = go.AddOption("Show");
            int toggle_index = go.AddOption("Toggle");

            go.Get();
            if (go.CommandResult() != Rhino.Commands.Result.Success)
            {
                return(go.CommandResult());
            }

            Rhino.Input.Custom.CommandLineOption option = go.Option();
            if (null == option)
            {
                return(Rhino.Commands.Result.Failure);
            }

            int index = option.Index;

            if (index == hide_index)
            {
                if (bVisible)
                {
                    Rhino.UI.Panels.ClosePanel(panelId);
                }
            }
            else if (index == show_index)
            {
                if (!bVisible)
                {
                    Rhino.UI.Panels.OpenPanel(panelId);
                }
            }
            else if (index == toggle_index)
            {
                if (bVisible)
                {
                    Rhino.UI.Panels.ClosePanel(panelId);
                }
                else
                {
                    Rhino.UI.Panels.OpenPanel(panelId);
                }
            }

            return(Rhino.Commands.Result.Success);
        }
Beispiel #2
0
    internal Rhino.Input.Custom.CommandLineOption m_option;// = null; initialized to null by runtime
    public Rhino.Input.Custom.CommandLineOption Option()
    {
      IntPtr pConstThis = ConstPointer();
      IntPtr pOption = UnsafeNativeMethods.CRhinoGet_Option(pConstThis);
      if (pOption == IntPtr.Zero)
        return null;

      if (m_option == null)
        m_option = new Rhino.Input.Custom.CommandLineOption();
      m_option.m_ptr = pOption;
      return m_option;
    }