示例#1
0
        protected override void Initialize()
        {
            base.Initialize();

            var componentModel = this.GetService <SComponentModel, IComponentModel>();
            var manager        = componentModel.GetService <EmacsCommandsManager>();

            try
            {
                // if the emacs keybindings are not installed and the user is not running elevated
                // then we need to copy the emacs.vsk for our extension to work
                // get an ok from the user first
                if (!manager.IsEmacsVskInstalled)
                {
                    string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                    installPath = Path.Combine(installPath, EmacsCommandsManager.EmacsVskFile);

                    var dlg = new CopyFileConfirmationDialog();
                    dlg.StartPosition = FormStartPosition.CenterScreen;
                    if (IsAdministrator || dlg.ShowDialog() == DialogResult.OK)
                    {
                        CopyVskUsingXCopy(installPath, manager);
                    }
                }
            }
            catch (Exception)
            {
            }

            manager.CheckEmacsVskSelected();
        }
        protected override void Initialize()
        {
            base.Initialize();

            var componentModel = this.GetService<SComponentModel, IComponentModel>();
            var manager = componentModel.GetService<EmacsCommandsManager>();

            try
            {
                // if the emacs keybindings are not installed and the user is not running elevated
                // then we need to copy the emacs.vsk for our extension to work
                // get an ok from the user first
                if (!manager.IsEmacsVskInstalled)
                {

                    string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                    installPath = Path.Combine(installPath, EmacsCommandsManager.EmacsVskFile);

                    var dlg = new CopyFileConfirmationDialog();
                    dlg.StartPosition = FormStartPosition.CenterScreen;
                    if (IsAdministrator || dlg.ShowDialog() == DialogResult.OK)
                    {
                        CopyVskUsingXCopy(installPath, manager);
                    }
                }
            }
            catch (Exception)
            {
            }

            manager.CheckEmacsVskSelected();
        }
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

            await base.InitializeAsync(cancellationToken, progress);

            var componentModel = await this.GetServiceAsync(typeof(SComponentModel)) as IComponentModel;

            var manager = componentModel.GetService <EmacsCommandsManager>();

            try
            {
                // if the emacs keybindings are not installed and the user is not running elevated
                // then we need to copy the emacs.vsk for our extension to work
                // get an ok from the user first
                if (!manager.IsEmacsVskInstalled)
                {
                    string installPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                    installPath = Path.Combine(installPath, EmacsCommandsManager.EmacsVskFile);

                    var dlg = new CopyFileConfirmationDialog();
                    dlg.StartPosition = FormStartPosition.CenterScreen;
                    if (IsAdministrator || dlg.ShowDialog() == DialogResult.OK)
                    {
                        CopyVskUsingXCopy(installPath, manager);
                    }
                }
            }
            catch (Exception)
            {
            }

            manager.CheckEmacsVskSelected();
        }