當前位置: 首頁>>代碼示例>>C#>>正文


C# AddIn類代碼示例

本文整理匯總了C#中AddIn的典型用法代碼示例。如果您正苦於以下問題:C# AddIn類的具體用法?C# AddIn怎麽用?C# AddIn使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AddIn類屬於命名空間,在下文中一共展示了AddIn類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: BuildCondition

		/// <summary>
		/// Returns a newly build <code>ICondition</code> object.
		/// </summary>
		public ICondition BuildCondition(AddIn addIn)
		{
			//一個AddIn並沒有和一個ICondition關聯,所以創建一個ICondition時可以不必提供AddIn對象
			ICondition condition = (ICondition)assembly.CreateInstance(className, true);
			
			return condition;
		}
開發者ID:tangxuehua,項目名稱:DataStructure,代碼行數:10,代碼來源:ConditionBuilder.cs

示例3: fmReportTypeSelect

 public fmReportTypeSelect(String r, DTE2 ao, AddIn aii)
 {
     Result = r;
     applicationObject = ao;
     addInInstance = aii;
     InitializeComponent();
 }
開發者ID:san90279,項目名稱:UK_OAS,代碼行數:7,代碼來源:fmReportTypeSelect.cs

示例4: GetRegisteredCommand

		/// <summary>
		/// Gets a known WPF command.
		/// </summary>
		/// <param name="addIn">The addIn definition that defines the command class.</param>
		/// <param name="commandName">The name of the command, e.g. "Copy".</param>
		/// <returns>The WPF ICommand with the given name, or null if thecommand was not found.</returns>
		public static System.Windows.Input.ICommand GetRegisteredCommand(AddIn addIn, string commandName)
		{
			if (addIn == null)
				throw new ArgumentNullException("addIn");
			if (commandName == null)
				throw new ArgumentNullException("commandName");
			System.Windows.Input.ICommand command;
			lock (knownCommands) {
				if (knownCommands.TryGetValue(commandName, out command))
					return command;
			}
			int pos = commandName.LastIndexOf('.');
			if (pos > 0) {
				string className = commandName.Substring(0, pos);
				string propertyName = commandName.Substring(pos + 1);
				Type classType = addIn.FindType(className);
				if (classType != null) {
					PropertyInfo p = classType.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Static);
					if (p != null)
						return (System.Windows.Input.ICommand)p.GetValue(null, null);
					FieldInfo f = classType.GetField(propertyName, BindingFlags.Public | BindingFlags.Static);
					if (f != null)
						return (System.Windows.Input.ICommand)f.GetValue(null);
				}
			}
			return null;
		}
開發者ID:Bombadil77,項目名稱:SharpDevelop,代碼行數:33,代碼來源:MenuService.cs

示例5: CommandManager

        /// <summary>
        /// Constructor
        /// </summary>
        public CommandManager(DTE2 dte, AddIn addin)
        {
            this.dte = dte;
            this.addIn = addin;

            commands = new Dictionary<string, CommandBase>();
        }
開發者ID:ptomasroos,項目名稱:ivyvisual,代碼行數:10,代碼來源:CommandManager.cs

示例6: frmEEPReport

 public frmEEPReport(DTE2 dte2, AddIn addIn, bool isWebReport)
 {
     InitializeComponent();
     _dte2 = dte2;
     _addIn = addIn;
     _isWebReport = isWebReport;
 }
開發者ID:san90279,項目名稱:UK_OAS,代碼行數:7,代碼來源:frmEEPReport.cs

示例7: RubberduckMenu

        public RubberduckMenu(VBE vbe, AddIn addIn, IGeneralConfigService configService, IRubberduckParser parser, IActiveCodePaneEditor editor, IInspector inspector)
            : base(vbe, addIn)
        {
            _addIn = addIn;
            _parser = parser;
            _configService = configService;

            var testExplorer = new TestExplorerWindow();
            var testEngine = new TestEngine();
            var testGridViewSort = new GridViewSort<TestExplorerItem>(RubberduckUI.Result, false);
            var testPresenter = new TestExplorerDockablePresenter(vbe, addIn, testExplorer, testEngine, testGridViewSort);
            _testMenu = new TestMenu(vbe, addIn, testExplorer, testPresenter);

            var codeExplorer = new CodeExplorerWindow();
            var codePresenter = new CodeExplorerDockablePresenter(parser, vbe, addIn, codeExplorer);
            codePresenter.RunAllTests += CodePresenterRunAllAllTests;
            codePresenter.RunInspections += codePresenter_RunInspections;
            codePresenter.Rename += codePresenter_Rename;
            codePresenter.FindAllReferences += codePresenter_FindAllReferences;
            codePresenter.FindAllImplementations += codePresenter_FindAllImplementations;
            _codeExplorerMenu = new CodeExplorerMenu(vbe, addIn, codeExplorer, codePresenter);

            var todoSettings = configService.LoadConfiguration().UserSettings.ToDoListSettings;
            var todoExplorer = new ToDoExplorerWindow();
            var todoGridViewSort = new GridViewSort<ToDoItem>(RubberduckUI.Priority, false);
            var todoPresenter = new ToDoExplorerDockablePresenter(parser, todoSettings.ToDoMarkers, vbe, addIn, todoExplorer, todoGridViewSort);
            _todoItemsMenu = new ToDoItemsMenu(vbe, addIn, todoExplorer, todoPresenter);

            var inspectionExplorer = new CodeInspectionsWindow();
            var inspectionGridViewSort = new GridViewSort<CodeInspectionResultGridViewItem>(RubberduckUI.Component, false);
            var inspectionPresenter = new CodeInspectionsDockablePresenter(inspector, vbe, addIn, inspectionExplorer, inspectionGridViewSort);
            _codeInspectionsMenu = new CodeInspectionsMenu(vbe, addIn, inspectionExplorer, inspectionPresenter);

            _refactorMenu = new RefactorMenu(IDE, AddIn, parser, editor);
        }
開發者ID:ThunderFrame,項目名稱:Rubberduck,代碼行數:35,代碼來源:RubberduckMenu.cs

示例8: DockablePresenterBase

 protected DockablePresenterBase(VBE vbe, AddIn addin, IDockableUserControl control)
 {
     _vbe = vbe;
     _addin = addin;
     UserControl = control as UserControl;
     _window = CreateToolWindow(control);
 }
開發者ID:ThunderFrame,項目名稱:Rubberduck,代碼行數:7,代碼來源:DockablePresenterBase.cs

示例9: 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

示例10: ExpressionHighlighterPlugin

 public ExpressionHighlighterPlugin(Connect con, DTE2 appObject, AddIn addinInstance)
     : base(con, appObject, addinInstance)
 {
     workerToDos.WorkerReportsProgress = false;
     workerToDos.WorkerSupportsCancellation = true;
     workerToDos.DoWork += new System.ComponentModel.DoWorkEventHandler(workerToDos_DoWork);
 }
開發者ID:sgtgold,項目名稱:bids-helper-extension,代碼行數:7,代碼來源:ExpressionHighlighterPlugin.cs

示例11: 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

示例12: CommandBarBuilder

        public CommandBarBuilder(DTE2 dte, AddIn addin)
        {
            this.dte = dte;
            this.addIn = addin;

            createdControls = new List<CommandBarControl>();
        }
開發者ID:ptomasroos,項目名稱:ivyvisual,代碼行數:7,代碼來源:CommandBarBuilder.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)
		{
			_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

示例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)
        {
            _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

示例15:

        /// <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


注:本文中的AddIn類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。