Esempio n. 1
0
        protected override void Initialize()
        {
            //这里是插件被第一次执行的时候进行的操作,只会在第一次执行的时候执行一次
            base.Initialize();

            //绑定命令
            //new Setting(this).Bind();
            //new UpdateModelFromDB(this).Bind();
            //new AddModelProject(this).Bind();
            //new QuickRegion(this).Bind();
            //new CloneCurrentLine(this).Bind();
            //new About(this).Bind();
            //new Suggestion(this).Bind();
            //new Update(this).Bind();
            //new OpenInExplore(this).Bind();
            //new RestartVS(this).Bind();

            //自动绑定所有的命令,使用反射查找继承了MenuCommand的子类
            //为了提高效率,只在MenuCommand所在的程序集中查找子类
            foreach (var type in this.GetType().Assembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(MenuCommand)))
                {
                    MenuCommand command = Activator.CreateInstance(type, this) as MenuCommand;
                    if (command != null)
                    {
                        command.Bind();
                    }
                }
            }

            CheckOpenLessTab();
            CheckOpenAutoHeader();
            CheckOpenAutoBrace();
            //TextManagerEventSink.AddCommandFilter<CollapseXmlComment>();
            //TextManagerEventSink.RegisterViewEvent += new CollapseComment().TextManagerEventSink_RegisterViewEvent;
            VSBase.ApplicationObject.Events.DTEEvents.OnBeginShutdown += DTEEvents_OnBeginShutdown;

            hookVs.MouseEvent   += new HookVS.MouseEventHandle(TripleClick.MouseEvent);
            hookVs.KeyUpEvent   += new HookVS.KeyUpEventHandle(JumpInsert.KeyUpEvent);
            hookVs.KeyDownEvent += new HookVS.KeyUpEventHandle(JumpInsert.KeyDownEvent);

            ThreadPool.QueueUserWorkItem(delegate
            {
                if (UpdateFrm.IsNeedUpdate())
                {
                    MessageBox.Show("detected a new version for easyvs, please use menu easyvs->help->update for update");
                }
            });
        }