Inheritance: IReAttachHistory
Exemplo n.º 1
0
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            ReAttachUtils.SetUp(this);
            _history = new ReAttachHistory(this);

            AddService(typeof(ReAttachDebugger), CreateReAttachDebuggerAsync);
            AddService(typeof(ReAttachUi), CreateReAttachUiAsync);

            // This might be questionable, but time is short and initialization needed.
            await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            _ = await GetServiceAsync(typeof(ReAttachDebugger));

            var ui = (await GetServiceAsync(typeof(ReAttachUi))) as ReAttachUi;

            ui.Update();
        }
Exemplo n.º 2
0
        public async Task InitializeAsync(ReAttachPackage package, ReAttachHistory history, CancellationToken cancellationToken)
        {
            _package = package;
            _history = history;

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            _menu = (await package.GetServiceAsync(typeof(IMenuCommandService))) as IMenuCommandService;
            if (_menu == null)
            {
                ReAttachUtils.ShowStartupError("Unable to obtain reference to menu service.");
                return;
            }

            _options = new ReAttachOptions(package);

            for (var i = 0; i < ReAttachConstants.ReAttachHistorySize; i++)
            {
                var commandId = new CommandID(ReAttachConstants.ReAttachPackageCmdSet, ReAttachConstants.ReAttachCommandId + i);
                var command   = new OleMenuCommand(ReAttachCommandClicked, commandId);
                _menu.AddCommand(command);

                if (i > 0) // Hide all items except first one initially.
                {
                    command.Visible = false;
                }

                _commands[i] = command;
            }

            var buildToggleCommandId = new CommandID(ReAttachConstants.ReAttachPackageCmdSet,
                                                     ReAttachConstants.BuildBeforeReAttachCommandId);
            var buildCommand = new OleMenuCommand(ReAttachToggleBuildClicked, buildToggleCommandId);

            buildCommand.Visible = true;
            buildCommand.Checked = _options.BuildBeforeReAttach;
            _menu.AddCommand(buildCommand);
            _buildToggleCommand = buildCommand;
        }