Exemplo n.º 1
0
            public void OnConnection(object application_, ext_ConnectMode connectMode, object addInInst, ref Array custom)
            {
                if (null != m_plugin)
                {
                    return;
                }

                // Load up the options from file.
                string  optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftySolution.xml");
                Options options         = Options.Load(optionsFileName);

                // Create our main plugin facade.
                DTE2 application = (DTE2)application_;

                m_plugin = new Plugin(application, (AddIn)addInInst, "NiftySolution", "Aurora.NiftySolution.Connect", options);

                // Every plugin needs a command bar.
                CommandBar commandBar = m_plugin.AddCommandBar("NiftySolution", MsoBarPosition.msoBarTop);

                m_commandRegistry = new CommandRegistry(m_plugin, commandBar);

                // Initialize the logging system.
                if (Log.HandlerCount == 0)
                {
                                        #if DEBUG
                    Log.AddHandler(new DebugLogHandler());
                                        #endif

                    Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane));
                    Log.Prefix = "NiftySolution";
                }

                // Now we can take care of registering ourselves and all our commands and hooks.
                Log.Debug("Booting up...");
                Log.IncIndent();


                bool doBindings = options.EnableBindings;

                m_commandRegistry.RegisterCommand("NiftyOpen", doBindings, new QuickOpen(m_plugin));
                m_commandRegistry.RegisterCommand("NiftyToggle", doBindings, new ToggleFile(m_plugin));
                m_commandRegistry.RegisterCommand("NiftyClose", doBindings, new CloseToolWindow(m_plugin));
                m_commandRegistry.RegisterCommand("NiftyConfigure", doBindings, new Configure(m_plugin));

                if (options.SilentDebuggerExceptions || options.IgnoreDebuggerExceptions)
                {
                    m_debuggerEvents = application.Events.DebuggerEvents;
                    m_debuggerEvents.OnExceptionNotHandled += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(OnExceptionNotHandled);
                }

                m_timings = new SolutionBuildTimings(m_plugin);

                Log.DecIndent();
                Log.Debug("Initialized...");
            }
			public void OnConnection(object application_, ext_ConnectMode connectMode, object addInInst, ref Array custom)
			{
				if(null != m_plugin)
					return;

				// Load up the options from file.
				string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftySolution.xml");
				Options options = Options.Load(optionsFileName);

				// Create our main plugin facade.
				DTE2 application = (DTE2)application_;
				m_plugin = new Plugin(application, (AddIn)addInInst, "NiftySolution", "Aurora.NiftySolution.Connect", options);
				
				// Every plugin needs a command bar.
				CommandBar commandBar = m_plugin.AddCommandBar("NiftySolution", MsoBarPosition.msoBarTop);
				m_commandRegistry = new CommandRegistry(m_plugin, commandBar);

				// Initialize the logging system.
				if(Log.HandlerCount == 0)
				{
					#if DEBUG
					Log.AddHandler(new DebugLogHandler());
					#endif

					Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane));
					Log.Prefix = "NiftySolution";
				}

				// Now we can take care of registering ourselves and all our commands and hooks.
				Log.Debug("Booting up...");
				Log.IncIndent();


				bool doBindings = options.EnableBindings;

				m_commandRegistry.RegisterCommand("NiftyOpen", doBindings, new QuickOpen(m_plugin));
				m_commandRegistry.RegisterCommand("NiftyToggle", doBindings, new ToggleFile(m_plugin));
				m_commandRegistry.RegisterCommand("NiftyClose", doBindings, new CloseToolWindow(m_plugin));
				m_commandRegistry.RegisterCommand("NiftyConfigure", doBindings, new Configure(m_plugin));

                if (options.SilentDebuggerExceptions || options.IgnoreDebuggerExceptions)
                {
                    m_debuggerEvents = application.Events.DebuggerEvents;
                    m_debuggerEvents.OnExceptionNotHandled += new _dispDebuggerEvents_OnExceptionNotHandledEventHandler(OnExceptionNotHandled);
                }

				m_timings = new SolutionBuildTimings(m_plugin);

				Log.DecIndent();
				Log.Debug("Initialized...");
			}