/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // 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 = GetGlobalService(typeof(DTE)) as DTE2; IVsProfferCommands3 profferCommands3 = base.GetService(typeof(SVsProfferCommands)) as IVsProfferCommands3; OleMenuCommandService oleMenuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; ImageList icons = new ImageList(); icons.Images.AddStrip(Properties.Resources.Icons); m_plugin = new Plugin(application, profferCommands3, icons, oleMenuCommandService, "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, new Guid(PackageGuidString), new Guid(PackageGuidGroup)); // Initialize the logging system. if (Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin)); 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(doBindings, new QuickOpen(m_plugin, "NiftyOpen")); m_commandRegistry.RegisterCommand(doBindings, new ToggleFile(m_plugin, "NiftyToggle")); m_commandRegistry.RegisterCommand(doBindings, new CloseToolWindow(m_plugin, "NiftyClose")); m_commandRegistry.RegisterCommand(doBindings, new Configure(m_plugin, "NiftyConfigure")); 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..."); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { base.Initialize(); // 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 = GetGlobalService(typeof(DTE)) as DTE2; IVsProfferCommands3 profferCommands3 = base.GetService(typeof(SVsProfferCommands)) as IVsProfferCommands3; OleMenuCommandService oleMenuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; ImageList icons = new ImageList(); icons.Images.AddStrip(Properties.Resources.Icons); m_plugin = new Plugin(application, profferCommands3, icons, oleMenuCommandService, "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, new Guid(PackageGuidString), new Guid(PackageGuidGroup)); // Initialize the logging system. if(Log.HandlerCount == 0) { #if DEBUG Log.AddHandler(new DebugLogHandler()); #endif Log.AddHandler(new VisualStudioLogHandler(m_plugin)); 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(doBindings, new QuickOpen(m_plugin, "NiftyOpen")); m_commandRegistry.RegisterCommand(doBindings, new ToggleFile(m_plugin, "NiftyToggle")); m_commandRegistry.RegisterCommand(doBindings, new CloseToolWindow(m_plugin, "NiftyClose")); m_commandRegistry.RegisterCommand(doBindings, new Configure(m_plugin, "NiftyConfigure")); 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..."); }