protected override void Initialize()
        {
            base.Initialize();
            DTE = GetService(typeof(DTE)) as DTE2;

            Logger.Initialize(this, Vsix.Name, Vsix.Version, "2e1b5120-2d5c-4324-82a3-ac73aafad731");
            FileNestingFactory.Enable(DTE);

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                CommandID      commandId   = new CommandID(PackageGuids.guidFileNestingCmdSet, PackageIds.NestingMenu);
                OleMenuCommand menuCommand = new OleMenuCommand((s, e) => { }, commandId);
                menuCommand.BeforeQueryStatus += ShowMenu;
                mcs.AddCommand(menuCommand);

                UnNestButton.Register(mcs);
                NestButton.Register(mcs);
                EnableAutoNestButton.Register(DTE, mcs);
                RunAutoNestingButton.Register(DTE, mcs);
            }

            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                Options = (NestingOptions)GetDialogPage(typeof(NestingOptions));
                FileNestingFactory.Enabled = true;
            }), DispatcherPriority.ApplicationIdle, null);
        }
Beispiel #2
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            DTE = GetService(typeof(DTE)) as DTE2;

            Logger.Initialize(this, Vsix.Name);
            FileNestingFactory.Enable(DTE);

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                CommandID      commandId   = new CommandID(PackageGuids.guidFileNestingCmdSet, PackageIds.NestingMenu);
                OleMenuCommand menuCommand = new OleMenuCommand((s, e) => { }, commandId);
                menuCommand.BeforeQueryStatus += ShowMenu;
                mcs.AddCommand(menuCommand);

                UnNestButton.Register(mcs);
                NestButton.Register(mcs);
                EnableAutoNestButton.Register(DTE, mcs);
                RunAutoNestingButton.Register(DTE, mcs);
            }

            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                Options = (NestingOptions)GetDialogPage(typeof(NestingOptions));
                FileNestingFactory.Enabled = true;
            }), DispatcherPriority.ApplicationIdle, null);
        }
Beispiel #3
0
        protected override void Initialize()
        {
            base.Initialize();
            DTE = GetService(typeof(DTE)) as DTE2;

            FileNestingFactory.Enable(DTE);

            OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;

            if (null != mcs)
            {
                CommandID      commandId   = new CommandID(GuidList.guidFileNestingCmdSet, (int)PkgCmdIDList.Nestingmenu);
                OleMenuCommand menuCommand = new OleMenuCommand((s, e) => { }, commandId);
                menuCommand.BeforeQueryStatus += ShowMenu;
                mcs.AddCommand(menuCommand);

                UnNestButton.Register(mcs);
                NestButton.Register(mcs);
                EnableAutoNestButton.Register(DTE, mcs);
                RunAutoNestingButton.Register(DTE, mcs);
            }

            Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
            {
                Options = (NestingOptions)GetDialogPage(typeof(NestingOptions));
                FileNestingFactory.Enabled = true;
            }), DispatcherPriority.ApplicationIdle, null);
        }
Beispiel #4
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            DTE = await GetServiceAsync(typeof(DTE)) as DTE2;

            FileNestingFactory.Enable(DTE);

            await JoinableTaskFactory.SwitchToMainThreadAsync();

            await Logger.Initialize(this, Vsix.Name);

            if (GetService(typeof(IMenuCommandService)) is OleMenuCommandService mcs)
            {
                CommandID      commandId   = new CommandID(PackageGuids.guidFileNestingCmdSet, PackageIds.NestingMenu);
                OleMenuCommand menuCommand = new OleMenuCommand((s, e) => { }, commandId);
                menuCommand.BeforeQueryStatus += ShowMenu;
                mcs.AddCommand(menuCommand);

                UnNestButton.Register(mcs);
                NestButton.Register(mcs);
                EnableAutoNestButton.Register(DTE, mcs);
                RunAutoNestingButton.Register(DTE, mcs);
            }

            Options = (NestingOptions)GetDialogPage(typeof(NestingOptions));
            FileNestingFactory.Enabled = true;
        }