public static O2_VS_AddIn add_Command <T>(this O2_VS_AddIn o2Addin)
            where T : CommandBase
        {
            var command = (T)typeof(T).ctor(o2Addin);

            return(o2Addin);
        }
        public static Panel add_WinForm_Control_from_O2Script(this O2_VS_AddIn o2Addin, string title, string o2Script, string type, int width = -1, int height = -1)
        {
            var assembly   = new CompileEngine().compileSourceFile(o2Script.local());
            var editorType = assembly.type(type);

            var panel = o2Addin.add_WinForm_Panel(title, width, height);

            panel.add_Control(editorType);
            return(panel);
        }
        public static CommandBase add_MenuItem(this O2_VS_AddIn o2AddIn, string buttonText, string targetMenu, Action onExecute)
        {
            var newCommand = new CommandBase(o2AddIn)
            {
                ButtonText = buttonText,
                TargetMenu = targetMenu,
                Execute    = onExecute
            };

            newCommand.create();
            return(newCommand);
        }
        public static bool executeCommand(this O2_VS_AddIn o2Addin, string commandName)
        {
            //var result = (commandName == o2Addin.FullName);
            if (o2Addin.Commands.hasKey(commandName))
            {
                O2Thread.mtaThread(() => o2Addin.Commands[commandName].Execute());;
                return(true);


                //	O2Gui.open<ascx_LogViewer>("Asp.Net O2 LogViewer", 400, 400);
            }
            return(false);
        }
        public static CommandBarPopup add_TopMenu(this O2_VS_AddIn o2AddIn, string caption)
        {
            var addAfterMenu   = "Help";           //"Tools"
            var commandBars    = (CommandBars)o2AddIn.VS_Dte.CommandBars;
            var menuCommandBar = commandBars["MenuBar"];
            var position       = (commandBars[addAfterMenu].Parent as CommandBarControl).Index;

            position++;
            var newMenu = (CommandBarPopup)menuCommandBar.Controls.Add(MsoControlType.msoControlPopup, System.Type.Missing, System.Type.Missing, position, true);

            newMenu.Caption = caption;
            newMenu.Enabled = true;
            return(newMenu);
        }
        public static O2_VS_AddIn create_FromO2LiveObjects()
        {
            var vsAddIn = new O2_VS_AddIn();

            vsAddIn.VS_Dte   = (DTE2)O2LiveObjects.get("VisualStudio_Dte");
            vsAddIn.VS_AddIn = (AddIn)O2LiveObjects.get("VisualStudio_AddIn");
            vsAddIn.VS_Type  = (string)O2LiveObjects.get("VisualStudio_Type");

            if (vsAddIn.notNull())
            {
                "[O2_VS_AddIn] loaded DTE2 object from O2LiveObjects".info();
                return(vsAddIn);
            }

            "[O2_VS_AddIn] failed to load  DTE2 object from  O2LiveObjects".error();
            return(null);
        }
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            //MessageBox.Show("This was dynamically changed....!!!AAasd");

            //MessageBox.Show("connectMode...:"  + connectMode.str());
            //if (connectMode.uiSetUp())
            //if (VS_AddIn == null)
            {
                //MessageBox.Show("Thanks for using the: O2 VisualStudio PlugIn");
                var type = "O2.VisualStudio.Connect"; //this.typeFullName()
                VS_AddIn = new O2_VS_AddIn().setup((DTE2)application, (AddIn)addInInst, type);
                if (VS_AddIn.isNull())
                {
                    MessageBox.Show("VS_AddIn was null, something is wrong");
                }
            }
        }
 public static bool showCommand(this O2_VS_AddIn o2Addin, string commandName)
 {
     //		Debug.WriteLine("in showCommand: {0}".format(commandName));
     return(o2Addin.Commands.hasKey(commandName));
     //return (commandName == o2Addin.FullName);
 }
 public static Panel add_WinForm_Panel(this O2_VS_AddIn o2Addin, string title, int width = -1, int height = -1)
 {
     return(o2Addin.VS_Dte.createWindowWithPanel(o2Addin.VS_AddIn, title, width, height));
 }
Ejemplo n.º 10
0
 public O2_ScriptGui(O2_VS_AddIn o2AddIn) : base(o2AddIn)
 {
     this.create();
 }
Ejemplo n.º 11
0
 public CommandBase(O2_VS_AddIn o2AddIn)
 {
     O2AddIn = o2AddIn;
     Execute = () => { "no execution set for this command".info(); };
 }
 public O2_LogViewer(O2_VS_AddIn o2AddIn) : base(o2AddIn)
 {
     this.create();
 }
 public VS2010_TeamMentor_Menu(O2_VS_AddIn o2AddIn) : base(o2AddIn)
 {
     this.create();
 }