当前位置: 首页>>代码示例>>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;未经允许,请勿转载。