コード例 #1
0
        /// <summary>
        /// Default constructor of the package.
        /// Inside this method you can place any initialization code that does not require
        /// any Visual Studio service because at this point the package object is created but
        /// not sited yet inside Visual Studio environment. The place to do all the other
        /// initialization is the Initialize method.
        /// </summary>
        public TitleBarNonePackage()
        {
            CurrentPackage = this;

            Globals.DTE = (DTE2)GetGlobalService(typeof(DTE));
            Globals.DTE.Events.DebuggerEvents.OnEnterBreakMode  += OnIdeEvent;
            Globals.DTE.Events.DebuggerEvents.OnEnterRunMode    += this.OnIdeEvent;
            Globals.DTE.Events.DebuggerEvents.OnEnterDesignMode += this.OnIdeEvent;
            Globals.DTE.Events.DebuggerEvents.OnContextChanged  += this.OnIdeEvent;
            Globals.DTE.Events.SolutionEvents.AfterClosing      += this.OnIdeSolutionEvent;
            Globals.DTE.Events.SolutionEvents.Opened            += this.OnIdeSolutionEvent;
            Globals.DTE.Events.SolutionEvents.Renamed           += this.OnIdeSolutionEvent;
            Globals.DTE.Events.WindowEvents.WindowCreated       += this.OnIdeEvent;
            Globals.DTE.Events.WindowEvents.WindowClosing       += this.OnIdeEvent;
            Globals.DTE.Events.WindowEvents.WindowActivated     += this.OnIdeEvent;
            Globals.DTE.Events.DocumentEvents.DocumentOpened    += this.OnIdeEvent;
            Globals.DTE.Events.DocumentEvents.DocumentClosing   += this.OnIdeEvent;

            // use reflection to popuplate all the informers we have
            SupportedTags = System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
                            .Where(type => type.IsClass && type.Namespace == "Atma.TitleBarNone.Resolvers" &&
                                   !type.IsAbstract &&
                                   type.GetMember("TagNames").Count() != 0)
                            .Cast <Informers.Informer>()
                            .SelectMany(x => x.TagNames)
                            .ToList();
        }
コード例 #2
0
        /// <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 initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            CurrentPackage = this;

            GlobalSettingsWatcher.SettingsCleared   = OnSettingsCleared;
            SolutionSettingsWatcher.SettingsCleared = OnSettingsCleared;

            // update the title every 5 seconds for debugging
            this.ResetTitleTimer = new System.Windows.Forms.Timer {
                Interval = 5000
            };
            this.ResetTitleTimer.Tick += this.UpdateWindowTitleAsync;
            this.ResetTitleTimer.Start();
        }