How to see more than one Extension under view Tab?

Thiago_Sase wrote on 10/10/2024, 10:51 PM

@jetdv Sir, I watched the Build Command series on your YouTube channel and I created 2 extensions. But just one extension shows up under view tab.

I tried to rename the 2º extension to avoid conflicts names, but it is not showing.

1º Extension;
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using System.Windows.Forms;
using ScriptPortal.Vegas;


namespace CCTest
{
    public class CCTestDock : DockableControl
    {
        private CCTest.CCMainForm myform = null;

        public CCTestDock() : base("CCTestInternal")
        {
            this.DisplayName = "SAT";
        }

        public override DockWindowStyle DefaultDockWindowStyle
        {
            get { return DockWindowStyle.Docked; }
        }

        public override Size DefaultFloatingSize
        {
            get { return new Size(640, 480); }
        }

        protected override void OnLoad(EventArgs args)
        {
            myform = new CCTest.CCMainForm(myVegas);
            myform.Dock = DockStyle.Fill;
            this.Controls.Add(myform);
        }

        protected override void OnClosed(EventArgs args)
        {
            base.OnClosed(args);
        }
    }
}

public class CCTestCCM : ICustomCommandModule
{
    public Vegas myVegas = null;
    CustomCommand CCM = new CustomCommand(CommandCategory.View, "CCTest");

    public void InitializeModule(Vegas vegas)
    {
        myVegas = vegas;

        CCM.MenuItemName = "SAT for Vegas Pro";
    }

    public ICollection GetCustomCommands()
    {
        CCM.MenuPopup += this.HandlePICmdMenuPopup;
        CCM.Invoked += this.HandlePICmdInvoked;
        CustomCommand[] cmds = new CustomCommand[] { CCM };
        return cmds;
    }

    void HandlePICmdMenuPopup(Object sender, EventArgs args)
    {
        CCM.Checked = myVegas.FindDockView("CCTestInternal");
    }

    void HandlePICmdInvoked(Object sender, EventArgs args)
    {
        if (!myVegas.ActivateDockView("CCTestInternal"))
        {
            CCTest.CCTestDock CCMDock = new CCTest.CCTestDock();
            CCMDock.AutoLoadCommand = CCM;
            CCMDock.PersistDockWindowState = true;
            myVegas.LoadDockView(CCMDock);
        }
    }
}

2º Extension;
 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using System.Windows.Forms;
using ScriptPortal.Vegas;


namespace CCTestProduction
{
    namespace CCTestProduction
    {
        public class CCTestProductionDock : DockableControl
        {
            private CCMainTestProduction myform = null; // Reference to the updated UserControl

            public CCTestProductionDock() : base("CCTestProductionLine")
            {
                this.DisplayName = "Production Line";
            }

            public override DockWindowStyle DefaultDockWindowStyle
            {
                get { return DockWindowStyle.Docked; } // Sets the default docking style
            }

            public override Size DefaultFloatingSize
            {
                get { return new Size(640, 480); } // Sets the default floating size
            }

            protected override void OnLoad(EventArgs args)
            {
                // Create an instance of the updated UserControl
                myform = new CCMainTestProduction(myVegas);
                myform.Dock = DockStyle.Fill; // Fill the dockable control with the UserControl
                this.Controls.Add(myform); // Add the UserControl to the dockable control
            }

            protected override void OnClosed(EventArgs args)
            {
                base.OnClosed(args); // Call the base class implementation on close
            }
        }

        public class CCTestCCM : ICustomCommandModule
        {
            public Vegas myVegas = null;
            CustomCommand CCM = new CustomCommand(CommandCategory.View, "Production");

            public void InitializeModule(Vegas vegas)
            {
                myVegas = vegas;
                CCM.MenuItemName = "SAT - Production Line"; // Menu item name for the custom command
            }

            public ICollection GetCustomCommands()
            {
                CCM.MenuPopup += this.HandlePICmdMenuPopup; // Subscribe to menu popup event
                CCM.Invoked += this.HandlePICmdInvoked; // Subscribe to invoked event
                CustomCommand[] cmds = new CustomCommand[] { CCM }; // Create an array of commands
                return cmds;
            }

            void HandlePICmdMenuPopup(Object sender, EventArgs args)
            {
                CCM.Checked = myVegas.FindDockView("CCTestProductionLine"); // Check if the dock view is active
            }

            void HandlePICmdInvoked(Object sender, EventArgs args)
            {
                if (!myVegas.ActivateDockView("CCTestProductionLine")) // Try to activate the dock view
                {
                    CCTestProductionDock CCMDock = new CCTestProductionDock(); // Create an instance of the dockable control
                    CCMDock.AutoLoadCommand = CCM; // Set the auto-load command
                    CCMDock.PersistDockWindowState = true; // Enable persistent dock window state
                    myVegas.LoadDockView(CCMDock); // Load the dockable view
                }
            }
        }
    }
}

Please, Sir, Why I can not see both extensions under view tab? I'm only seeing one.

Comments

Thiago_Sase wrote on 10/11/2024, 8:47 AM

@jetdv Sir, I re-create the project in Visual Studio, and now it's showing both extensions.

jetdv wrote on 10/11/2024, 8:50 AM

That's good to hear. My only recommendation would have been to make sure you're changing all of these to unique names:

The names we will be changing in the base case are:

  • MyCCMainNameSpace - The namespace used by our CustomCommand
  • MyCCMainFormName - The class name the main form
  • MyCCDockcontrolClass - The class name for our DockableControl
  • MyCCVegasInternalName - A unique internal identifyer for VEGAS to use
  • MyCCVegasTabName - The name VEGAS will show on the custom command tab
  • MyCCccmClassName - The class name for the ICustomCommandModule
  • MyCCccVariable - A Variable to hold the new CustomCommand used to set various settings and determine which "Extensions" it appears in
  • MyCCVegasMenuText - The text that will show in the Extensions menu
  • MyCCDockcontrolVariable - A Variable used to set the DockControl parameters
Thiago_Sase wrote on 10/11/2024, 11:29 AM

@jetdv Thank very much, Sir! I'll pay attention carefully to those names on my next extension.