• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ext_ConnectMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ext_ConnectMode的典型用法代码示例。如果您正苦于以下问题:C# ext_ConnectMode类的具体用法?C# ext_ConnectMode怎么用?C# ext_ConnectMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ext_ConnectMode类属于命名空间,在下文中一共展示了ext_ConnectMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: OnConnection

        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            try
            {
                _application = Core.Default.CreateObjectFromComProxy(null, Application);

                /*
                * _application is stored as COMObject the common base type for all reference types in NetOffice
                * because this addin is loaded in different office application.
                * 
                * with the CreateObjectFromComProxy method the _application instance is created as corresponding wrapper based on the com proxy type
                */

                if (_application is Excel.Application)
                   _hostApplicationName = "Excel";
                else if (_application is Word.Application)
                   _hostApplicationName = "Word";
                else if (_application is Outlook.Application)
                   _hostApplicationName = "Outlook";
                else if (_application is PowerPoint.Application)
                   _hostApplicationName = "PowerPoint";
                else if (_application is Access.Application)
                   _hostApplicationName = "Access";
            }
            catch (Exception exception)
            {
                if(_hostApplicationName != null)
                    OfficeRegistry.LogErrorMessage(_hostApplicationName, _progId, "Error occured in OnConnection. ", exception);
            }
        }
开发者ID:swatt6400,项目名称:NetOffice,代码行数:30,代码来源:Addin.cs


示例2: OnConnection

        /// <summary>Implements the constructor for the Add-in object. Place your initialization code within this method.</summary>
        //public Connect()
        //{
        //}
        /// <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) {
            applicationObject = (DTE2) application;
            addInInstance = (AddIn) addInInst;

            // Only execute the startup code if the connection mode is a startup mode
            //if( connectMode == ext_ConnectMode.ext_cm_UISetup ) {
            if (connectMode == ext_ConnectMode.ext_cm_AfterStartup) {
                //Initializing Context
                Context.ApplicationObject = applicationObject;
                Context.AddInInstance = addInInstance;

                //Initializing EventSinks
                SolutionEventSink solutionEventSink = new SolutionEventSink();
                addinEventSink = new AddinEventSink();

                //Initializing Controller
                controller = new UIController();
                controller.Sinks.Add(solutionEventSink);
                controller.Sinks.Add(addinEventSink);
                controller.Init(solutionEventSink, addinEventSink);

                addinEventSink.OnStartup(applicationObject);

                if (Context.ApplicationObject.Solution.IsOpen){
                    solutionEventSink.OnOpenSolution();
                }
            }
        }
开发者ID:Dashboard-X,项目名称:JIRA_Connector_1.0.0_Beta_1,代码行数:37,代码来源:Connect.cs


示例3: OnConnection

        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            var dte = application as DTE;
            if (dte == null) return;
            _dte = dte;
            try
            {
                if (dte.Version != DteVersion)
                {
                    Notify("OpenWrap Visual Studio integration is not correct version, re-creating now.");
                    dte.Solution.AddIns.OfType<AddIn>().First(x => x.ProgID == _progId).Remove();
                    if (dte.Version == "9.0")
                        dte.Solution.AddIns.Add(ComConstants.ADD_IN_PROGID_2008, ComConstants.ADD_IN_DESCRIPTION, ComConstants.ADD_IN_NAME, true);
                    else if (dte.Version == "10.0")
                        dte.Solution.AddIns.Add(ComConstants.ADD_IN_PROGID_2010, ComConstants.ADD_IN_DESCRIPTION, ComConstants.ADD_IN_NAME, true);
                    else if (dte.Version == "11.0")
                        dte.Solution.AddIns.Add(ComConstants.ADD_IN_PROGID_2012, ComConstants.ADD_IN_DESCRIPTION, ComConstants.ADD_IN_NAME, true);
                    return;
                }
                _rootPath = GetRootLocation(dte.Solution.FullName);
                if (_rootPath == null) return;
                Notify("OpenWrap Visual Studio Integration ({0}) starting.", FileVersionInfo.GetVersionInfo(GetType().Assembly.Location).FileVersion);
                Notify("Root location: " + _rootPath);

                LoadAppDomain();
            }
            catch (Exception e)
            {
                Notify("OpenWrap failed to initialize. Improbability Drive has been activated.\r\n", e.ToString());
            }
        }
开发者ID:mmasciotra,项目名称:openwrap,代码行数:31,代码来源:OpenWrapVisualStudioAddIn.cs


示例4: OnConnection

        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            try
            {
                _vbe = Application as VBE;
                _addin = AddInInst as AddIn;

                switch (ConnectMode)
                {
                    case ext_ConnectMode.ext_cm_AfterStartup:
                        InitializeAddIn();
                        break;
                    case ext_ConnectMode.ext_cm_Startup:
                        break;
                    case ext_ConnectMode.ext_cm_External:
                        break;
                    case ext_ConnectMode.ext_cm_CommandLine:
                        break;
                    default:
                        throw new ArgumentOutOfRangeException("ConnectMode");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
开发者ID:LuckyTeng,项目名称:VBAddIn,代码行数:27,代码来源:Connect.cs


示例5: OnConnection

       /// <summary>Implements the OnConnection method of theIDTExtensibility2 interface. Receives notification that the Add-in isbeing loaded.</summary>
       /// <param term='application'>Root object of the hostapplication.</param>
       /// <param term='connectMode'>Describes how the Add-in isbeing 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)
       {
           try
           {
               Logger.SetListener(new FileLogger());

               Logger.Write("Connecting to Visual Studio");
               _applicationObject = (DTE2) application;
               StartupHandler.SetApplication(_applicationObject);
               setupListener();
               bindWorkspaceEvents();
               SolutionStateHandler.BindEvents(_applicationObject);
               SaverOfFilesThatVSKeepsStashigInMem.BindEvents(_applicationObject);
               _addInInstance = (AddIn) addInInst;

               Logger.Write("Adding menu item");
               RegisterCommandHandlers();
               if (connectMode == ext_ConnectMode.ext_cm_UISetup || theShitIsNotThere())
               {
                   if (connectMode == ext_ConnectMode.ext_cm_UISetup)
                       Analytics.SendEvent("UI_SETUP");
                   else
                       Analytics.SendEvent("UI_SETUP_MANUAL");
                   AddMenuItems();
                   Logger.Write("Menu item added");
                   _initializedMenu = true;
               }
               AddContextMenue();
           }
           catch(Exception ex)
           {
               Logger.Write("OnConnect " + ex);
           }
       }
开发者ID:jeroldhaas,项目名称:ContinuousTests,代码行数:39,代码来源:Connect.cs


示例6: OnConnection

		/// <summary>
		/// Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.
		/// </summary>
		/// <param name='application'>
		/// Root object of the host application.
		/// </param>
		/// <param name='connectMode'>
		/// Describes how the Add-in is being loaded.
		/// </param>
		/// <param name='addIn'>
		/// Object representing this Add-in.
		/// </param>
		/// /// <param name='custom'>
		/// Array of parameters that are host application specific.
		/// </param>
		/// <seealso class='IDTExtensibility2' />
		public void OnConnection(object application, ext_ConnectMode connectMode, object addIn, ref Array custom)
		{
			_application = (DTE2)application;
			_addIn = (AddIn)addIn;
			try
			{
				if (connectMode == ext_ConnectMode.ext_cm_Startup || connectMode == ext_ConnectMode.ext_cm_AfterStartup)
				{
					_listener = CreateTraceListener();
					_env = new ControllerEnvironment(new WindowHandle(_application.MainWindow.HWnd), _listener);
					_controller = CreateController();
					_controller.OnConnectionStateChange += OnConnectionStateChange;
					CreateCommands();
					CreateToolWindow();
					_listener.WriteLine("Addin initialized");
					if (connectMode == ext_ConnectMode.ext_cm_AfterStartup)
					{
						OnStartupComplete(ref custom);
					}
				}
			}
			catch (Exception ex)
			{
				if (_listener != null)
				{
					_listener.WriteLine(ex);
				}
			}
		}
开发者ID:TargetProcess,项目名称:Tp.Integration.Ide.VisualStudio,代码行数:45,代码来源:Connect.cs


示例7: OnConnection

		/// <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)
		{
			_application = (DTE2)application;
			_addInInstance = (AddIn)addInInst;

			// Core
			var name = _addInInstance.Name;
			var outputPane = _application.ToolWindows.OutputWindow.OutputWindowPanes.GetPane(name);
			var feedback = new FeedbackManager(name, outputPane);
			_core = new Core(feedback);

			// Events
			_events = (Events2)_application.Events;
			_projectsEvents = _events.ProjectsEvents;
			_projectItemsEvents = _events.ProjectItemsEvents;
			_documentEvents = _events.DocumentEvents;
			_buildEvents = _events.BuildEvents;
			
			AttachEvents();

			// If being connected when Solution is already loaded - try to load all projects
			if (_application.Solution != null)
			{
				_core.Load(_application.Solution);
			}
		}
开发者ID:MartinF,项目名称:Dynamo.AutoTT,代码行数:31,代码来源:Connect.cs


示例8:

        /// <summary>
        /// Implements the OnConnection method of the IDTExtensibility2 interface.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Receives notification that the Add-in is being loaded.
        /// </para>
        /// </remarks>
        /// <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' />
        void IDTExtensibility2.OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            dte = (DTE2)application;
            addIn = (AddIn)addInInst;

            ShellProxy.Instance.AddInConnected(this);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:19,代码来源:ShellAddInHandler.cs


示例9: OnConnection

		public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
		{
			try
			{
				this._applicationObject = (DTE2)application;
				this._addInInstance = (AddIn)addInInst;
				if (connectMode == ext_ConnectMode.ext_cm_Startup && AddinSetupState.State == SetupState.FirstRun)
				{
					LogHelper.LogDebug("Add-in SetupState is FirstRun");
					LogHelper.LogDebug("Removing add-in commands");
					this.RemoveAddinCommands();
					LogHelper.LogDebug("Creating add-in commands");
					this.CreateAddinCommands();
					LogHelper.LogDebug("Opening FirstRunStep1 form");
					FirstRunStep1 firstRunStep = new FirstRunStep1();
					firstRunStep.ShowDialog();
					LogHelper.LogDebug("Setting add-in SetupState to complete");
					AddinSetupState.State = SetupState.SetupComplete;
				}
				if (connectMode == ext_ConnectMode.ext_cm_Startup || connectMode == ext_ConnectMode.ext_cm_AfterStartup)
				{
					LogHelper.LogDebug("Creating add-in menus");
					this.CreateAddinMenus();
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message, "CodeKeep");
			}
		}
开发者ID:bcokur,项目名称:mydotnetsamples,代码行数:30,代码来源:Connect.cs


示例10: OnConnection

		/// <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)
		{
			_applicationObject = (DTE2)application;
			_addInInstance = (AddIn)addInInst;
            
            if (connectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                // Create the command object
                object[] contextGUIDS = new object[] { };
                Commands2 commands = (Commands2)_applicationObject.Commands;
                try
                {
                    Command cmd = commands.AddNamedCommand2(_addInInstance, "DocumentClass",
                      "Class Documentator", "Document your class module ", true, 59, ref contextGUIDS,
                      (int)vsCommandStatus.vsCommandStatusSupported +
                      (int)vsCommandStatus.vsCommandStatusEnabled,
                      (int)vsCommandStyle.vsCommandStylePictAndText,
                      vsCommandControlType.vsCommandControlTypeButton);
                    // Create a command bar on the code window
                    CommandBar CmdBar = ((CommandBars)_applicationObject.CommandBars)["Code Window"];
                    // Add a command to the Code Window's shortcut menu.
                    CommandBarControl cmdBarCtl = (CommandBarControl)cmd.AddControl(CmdBar,
                                                                   CmdBar.Controls.Count + 1);
                    cmdBarCtl.Caption = "Class Doc";
                }
                catch (System.ArgumentException)
                {
                }
            }
		}
开发者ID:Helen1987,项目名称:edu,代码行数:35,代码来源:Connect.cs


示例11: OnConnection

		/// <summary>
		/// Implements the OnDisconnection method of the IDTExtensibility2 interface. 
		/// Occurs when he Add-in is loaded into Visual Studio.
		/// </summary>
		/// <param name="application">A reference to an instance of the IDE, DTE.</param>
		/// <param name="connectMode">
		///   An <see cref="ext_ConnectMode"/> enumeration value that indicates 
		///   the way the add-in was loaded into Visual Studio.
		/// </param>
		/// <param name="instance">An <see cref="AddIn"/> reference to the add-in's own instance.</param>
		/// <param name="custom">An empty array that you can use to pass host-specific data for use in the add-in.</param>
		public void OnConnection(object application, ext_ConnectMode connectMode, object instance, ref Array custom)
		{
			App = (DTE2) application;
			Instance = (AddIn) instance;
			Events = App.Events as Events2;
			Logger = new OutputWindowLogger(App);

			Logger.Log("Loading...");

			Compose(); // Do not attempt to use [Import]s before this line!

			if(Chirp == null)
			{
				Logger.Log("Unable to load.");
				return;
			}

			BindEvents();

			PrintLoadedEngines();

			Logger.Log("Ready");

			if(App.Solution.IsOpen)
			{
				SolutionOpened();

				foreach (var project in App.Solution.Projects.Cast<Project>())
				{
					ProjectAdded(project);
				}
			}
		}
开发者ID:andyedinborough,项目名称:ChirpyMEF,代码行数:44,代码来源:ChirpyAddIn.cs


示例12: OnConnection

        /// <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)
        {
            _applicationObject = (DTE2)application;
            _addInInstance = (AddIn)addInInst;

            if (connectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                object[] contextGUIDS = new object[] { };
                Commands2 commands = (Commands2)_applicationObject.Commands;
                CommandBars cBars = (CommandBars)_applicationObject.CommandBars;
                try
                {
                    Command commandProjectSettings = commands.AddNamedCommand2(_addInInstance, "DavecProjectSchemaSettings", "Davec Project Settings", "Manages Database Project Settings", false, 1, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
                    Command commandAddSchemaUpdate = commands.AddNamedCommand2(_addInInstance, "DavecProjectUpdate", "Davec Update", "Updates Database Schema", false, 2, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

                    CommandBar vsBarProject = cBars["Project"];
                    CommandBar vsBarFolder = cBars["Folder"];

                    commandProjectSettings.AddControl(vsBarProject, 1);
                    commandAddSchemaUpdate.AddControl(vsBarFolder, 1);

                }
                catch (System.ArgumentException)
                {
                    //ignore
                }

                var _solutionEvents = _applicationObject.Events.SolutionEvents;
                _solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);

                var _documentEvents = _applicationObject.Events.DocumentEvents;
                _documentEvents.DocumentSaved += new _dispDocumentEvents_DocumentSavedEventHandler(_documentEvents_DocumentSaved);
            }
        }
开发者ID:rajgit31,项目名称:VisualStudioExtensionSamples,代码行数:39,代码来源:Connect.cs


示例13: OnConnection

        /// <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)
        {
            _applicationObject = (DTE2)application;
            _addInInstance = (AddIn)addInInst;

            _dbgWatchConfig = new QuickWatchConfig();

            try {
                CommandBar commandBar = ((CommandBars)_applicationObject.CommandBars)["Code Window"];

                // Create Quick watch menu
                _controlQuickWatch = commandBar.Controls.Add(MsoControlType.msoControlButton, System.Reflection.Missing.Value, System.Reflection.Missing.Value, 1, true);
                _controlQuickWatch.Caption = "QuickWatchEx...";
                _controlQuickWatch.Enabled = IsInDebugMode(_applicationObject);

                _menuItemHandlerQuickWatch = (CommandBarEvents)_applicationObject.Events.CommandBarEvents[_controlQuickWatch];
                _menuItemHandlerQuickWatch.Click += MenuItemHandlerQuickWatch_Click;

                _debuggerEvents = _applicationObject.Events.DebuggerEvents;
                _debuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode;
                _debuggerEvents.OnEnterBreakMode += DebuggerEvents_OnEnterBreakMode;
                _debuggerEvents.OnEnterRunMode += DebuggerEvents_OnEnterRunMode;
            } catch (Exception e) {
                MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:dp0h,项目名称:QuickWatchEx,代码行数:31,代码来源:Connect.cs


示例14: OnConnection

        /// <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)
        {
            Globals.DTE = (DTE2)application;
            Globals.Addin = (AddIn)addInInst;

            solutionEvents = Globals.DTE.Events.SolutionEvents;
            solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
            solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(SolutionEvents_BeforeClosing);

            commandManager = new CommandManager(Globals.DTE, Globals.Addin);
            commandBarBuilder = new CommandBarBuilder(Globals.DTE, Globals.Addin);

            switch (connectMode)
            {
                case ext_ConnectMode.ext_cm_UISetup:
                    // Initialize the UI of the add-in
                    break;

                case ext_ConnectMode.ext_cm_Startup:
                    // The add-in was marked to load on startup
                    // Do nothing at this point because the IDE may not be fully initialized
                    // Visual Studio will call OnStartupComplete when fully initialized
                    break;

                case ext_ConnectMode.ext_cm_AfterStartup:
                    // The add-in was loaded by hand after startup using the Add-In Manager
                    // Initialize it in the same way that when is loaded on startup
                    Initialize();
                    break;
            }
        }
开发者ID:ptomasroos,项目名称:ivyvisual,代码行数:36,代码来源:Connect.cs


示例15: OnConnection

        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            pb = new PBHelper();
            application = (DTE2)Application;
            addInInstance = (AddIn)AddInInst;
            if (ConnectMode == ext_ConnectMode.ext_cm_UISetup)
            {
                object[] contextGUIDS = new object[] { };
                Commands2 commands = (Commands2)application.Commands;

                // get item bar
                Microsoft.VisualStudio.CommandBars.CommandBar itemCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)application.CommandBars)["Item"];

                try
                {
                    // add me commands
                    Command command = commands.AddNamedCommand2(addInInstance, "Dw2Struct", "Generate Structure", "Generates a structure of the columns in the datawindow", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);
                    Command command2 = commands.AddNamedCommand2(addInInstance, "Dw2Nv", "Generate NonVisualObject", "Generates an NonVisualObject of the columns in the datawindow", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton);

                    if ((command != null))
                    {
                        command.AddControl(itemCommandBar, itemCommandBar.Controls.Count);
                    }

                    if ((command2 != null))
                    {
                        command2.AddControl(itemCommandBar, itemCommandBar.Controls.Count);
                    }
                }
                catch (System.ArgumentException)
                {
                }
            }
        }
开发者ID:devbar,项目名称:PB-Addin-Dw2Struct,代码行数:34,代码来源:Connect.cs


示例16: OnConnection

    /// <summary>
    /// Implements the OnConnection method of the IDTExtensibility2 interface.
    /// Receives notification that the Add-in is being loaded.
    /// </summary>
    /// <param name="application">Root object of the host application.</param>
    /// <param name="connectMode">
    /// Describes how the Add-in is being loaded (e.g. command line or UI). This is unused since
    /// the add-in functions the same regardless of how it was loaded.
    /// </param>
    /// <param name="addInInst">Object representing this Add-in.</param>
    /// <param name="custom">Unused, but could contain host specific data for the add-in.</param>
    /// <seealso class='IDTExtensibility2' />
    public void OnConnection(
        object application,
        ext_ConnectMode connectMode,
        object addInInst,
        ref Array custom)
    {
      dte_ = (DTE2)application;

      debuggerEvents_ = dte_.Events.DebuggerEvents;
      debuggerEvents_.OnEnterDesignMode += DebuggerOnEnterDesignMode;
      debuggerEvents_.OnEnterRunMode += DebuggerOnEnterRunMode;

      commandEvents_ = dte_.Events.CommandEvents;
      commandEvents_.AfterExecute += CommandEventsAfterExecute;

      try
      {
        webServerOutputPane_ = dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item(
            Strings.WebServerOutputWindowTitle);
      }
      catch (ArgumentException)
      {
        // This exception is expected if the window pane hasn't been created yet.
        webServerOutputPane_ = dte_.ToolWindows.OutputWindow.OutputWindowPanes.Add(
            Strings.WebServerOutputWindowTitle);
      }
    }
开发者ID:udiavr,项目名称:nativeclient-sdk,代码行数:39,代码来源:Connect.cs


示例17: OnConnection

		/// <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)
		{
			_applicationObject = (DTE2)application;
			_addInInstance = (AddIn)addInInst;
			if(connectMode == ext_ConnectMode.ext_cm_UISetup)
			{
                // Add the command
                Command cmd = (Command)_applicationObject.Commands.AddNamedCommand(_addInInstance,
                                      "BadWords", "BadWords",
                                      "Search for bad words", true, RED_STAR_ICON, null,
                                      (int)vsCommandStatus.vsCommandStatusSupported +
                                      (int)vsCommandStatus.vsCommandStatusEnabled);
                CommandBar stdCmdBar = null;
                // Reference the Visual Studio standard toolbar.
                CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;
                foreach (CommandBar cb in commandBars)
                {
                    if (cb.Name == "Standard")
                    {
                        stdCmdBar = cb;
                        break;
                    }
                }
                // Add a button to the standard toolbar.
                CommandBarControl stdCmdBarCtl = (CommandBarControl)cmd.AddControl(stdCmdBar,
                                                 stdCmdBar.Controls.Count + 1);
                // Set a caption for the toolbar button.
                stdCmdBarCtl.Caption = "Search for bad words";
                // Set the toolbar's button style to an icon button.
                CommandBarButton cmdBarBtn = (CommandBarButton)stdCmdBarCtl;
                cmdBarBtn.Style = MsoButtonStyle.msoButtonIcon;

			}
		}
开发者ID:Helen1987,项目名称:edu,代码行数:39,代码来源:Connect.cs


示例18: OnConnection

        public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom)
        {
            Connect.CurrentAddin = (EnvDTE.AddIn)AddInInst;
            Connect.CurrentApplication = (EnvDTE80.DTE2)Connect.CurrentAddin.DTE;

            SetObjectExplorerEventProvider();            
        }
开发者ID:herohut,项目名称:elab,代码行数:7,代码来源:Connect.cs


示例19: OnConnection

        /// <summary>
        /// Implements the OnConnection method of the IDTExtensibility2 interface.
        /// Receives notification that the Add-in is being loaded.
        /// </summary>
        /// <param name="application">The application.</param>
        /// <param name="connectMode">The connect mode.</param>
        /// <param name="addInInst">The add in inst.</param>
        /// <param name="custom">The custom.</param>
        /// <seealso class="IDTExtensibility2"/>
        public void OnConnection(object application, ext_ConnectMode connectMode,
            object addInInst, ref Array custom)
        {
            if (_gitPlugin == null)
            {
                var cultureInfo = new CultureInfo("en-US");
                Thread.CurrentThread.CurrentCulture = cultureInfo;

                _gitPlugin =
                    new Plugin((DTE2)application, (AddIn)addInInst, "GitExtensions", "GitPlugin.Connect");
            }

            switch (connectMode)
            {
                case ext_ConnectMode.ext_cm_UISetup:
                    // Install CommandBar permanently (only runs once per AddIn)
                    GitPluginUISetup();
                    break;

                case ext_ConnectMode.ext_cm_Startup:
                    // The add-in was marked to load on startup
                    // Do nothing at this point because the IDE may not be fully initialized
                    // Visual Studio will call OnStartupComplete when fully initialized
                    GitPluginUIUpdate();
                    break;

                case ext_ConnectMode.ext_cm_AfterStartup:
                    // The add-in was loaded by hand after startup using the Add-In Manager
                    // Initialize it in the same way that when is loaded on startup
                    GitPluginInit();
                    break;
            }
        }
开发者ID:HuChundong,项目名称:gitextensions,代码行数:42,代码来源:Connect.cs


示例20: OnConnection

 /// <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)
 {
     _applicationObject = (DTE2)application;
     _addInInstance = (AddIn)addInInst;
     if (connectMode == ext_ConnectMode.ext_cm_UISetup)
     {
         object[] contextGUIDS = new object[] { };
         Commands2 commands = (Commands2)_applicationObject.Commands;
         Microsoft.VisualStudio.CommandBars.CommandBar standardToolBar =
           ((Microsoft.VisualStudio.CommandBars.CommandBars)
           _applicationObject.CommandBars)["Project"];
         try
         {
             Command command = commands.AddNamedCommand2(_addInInstance, "MVCScaffolder",
                               "MVCScaffolder...", "Executes the command for MVCScaffolder",
                               true, 59, ref contextGUIDS,
                               (int)vsCommandStatus.vsCommandStatusSupported +
                               (int)vsCommandStatus.vsCommandStatusEnabled,
                               (int)vsCommandStyle.vsCommandStylePictAndText,
                               vsCommandControlType.vsCommandControlTypeButton);
             if ((command != null) && (standardToolBar != null))
             {
                 CommandBarControl ctrl =
                   (CommandBarControl)command.AddControl(standardToolBar, 1);
                 ctrl.TooltipText = "Executes the command for MVCScaffolder";
             }
         }
         catch (System.ArgumentException)
         {
         }
     }
 }
开发者ID:wangchunlei,项目名称:MyGit,代码行数:38,代码来源:Connect.cs



注:本文中的ext_ConnectMode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ext_DisconnectMode类代码示例发布时间:2022-05-24
下一篇:
C# expressions_list类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap