コード例 #1
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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            try
            {
                NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log");
                DebugEngineInstallService.TryRegisterAssembly();

                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                UserSettingsManager.Initialize(this);
                VSMonoDebuggerCommands.Initialize(this);
            }
            catch (UnauthorizedAccessException uex)
            {
                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                var package = this as Package;
                VsShellUtilities.ShowMessageBox(
                    package,
                    "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...",
                    $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine",
                    OLEMSGICON.OLEMSGICON_CRITICAL,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                NLogService.Logger.Error(uex);
            }
            catch (Exception ex)
            {
                NLogService.Logger.Error(ex);
            }

            await base.InitializeAsync(cancellationToken, progress);
        }
コード例 #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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            try
            {
                NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log");
                UserSettingsManager.Initialize(this);

                DebugEngineInstallService.TryRegisterAssembly();

                VSMonoDebuggerCommands.Initialize(this);
            }
            catch (UnauthorizedAccessException uex)
            {
                VsShellUtilities.ShowMessageBox(
                    this,
                    "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...",
                    $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine",
                    OLEMSGICON.OLEMSGICON_CRITICAL,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                NLogService.Logger.Error(uex);
            }
            catch (Exception ex)
            {
                NLogService.Logger.Error(ex);
            }
        }
コード例 #3
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 initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            try
            {
                NLogService.Setup($"{nameof(VSMonoDebuggerPackage)}.log");
                DebugEngineInstallService.TryRegisterAssembly();

                // see https://github.com/microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration
                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                var dte = await GetServiceAsync(typeof(EnvDTE.DTE)) as EnvDTE.DTE;

                var menuCommandService = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

                // TODO replace by services
                UserSettingsManager.Initialize(this);
                _monoVisualStudioExtension = new MonoVisualStudioExtension(this, dte);
                _monoDebuggerCommands      = new VSMonoDebuggerCommands(this, menuCommandService, _monoVisualStudioExtension);

                await AttachToEngineCommand.InitializeAsync(this, menuCommandService, _monoVisualStudioExtension);
            }
            catch (UnauthorizedAccessException uex)
            {
                await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);

                var package = this as Package;
                VsShellUtilities.ShowMessageBox(
                    package,
                    "Failed finish installation of VSMonoDebugger - Please run Visual Studio once as Administrator...",
                    $"{nameof(VSMonoDebuggerPackage)} - Register mono debug engine",
                    OLEMSGICON.OLEMSGICON_CRITICAL,
                    OLEMSGBUTTON.OLEMSGBUTTON_OK,
                    OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST);

                Logger.Error(uex);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            await base.InitializeAsync(cancellationToken, progress);
        }
コード例 #4
0
ファイル: VSPackage.cs プロジェクト: techl/MonoRemoteDebugger
        protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            var settingsManager            = new ShellSettingsManager(this);
            var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            UserSettingsManager.Initialize(configurationSettingsStore);
            MonoLogger.Setup();
            base.Initialize();
            var dte = await GetServiceAsync(typeof(DTE)) as DTE;

            monoExtension = new MonoVisualStudioExtension(dte);
            TryRegisterAssembly();


            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("/MonoRemoteDebugger.VSExtension;component/Resources/Resources.xaml", UriKind.Relative)
            });

            var mcs = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;

            InstallMenu(mcs);
        }
コード例 #5
0
        protected override void Initialize()
        {
            var settingsManager            = new ShellSettingsManager(this);
            var configurationSettingsStore = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

            UserSettingsManager.Initialize(configurationSettingsStore);
            MonoLogger.Setup();
            base.Initialize();
            var dte = (DTE)GetService(typeof(DTE));

            monoExtension = new MonoVisualStudioExtension(dte);
            TryRegisterAssembly();


            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("/MonoDebugger.VS2015;component/Resources/Resources.xaml", UriKind.Relative)
            });

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

            InstallMenu(mcs);
        }
コード例 #6
0
        protected override void Initialize()
        {
            UserSettingsManager.Initialize(this);

            MonoLogger.Setup();

            base.Initialize();

            var dte = (DTE)GetService(typeof(DTE));

            _monoExtension = new MonoVisualStudioExtension(dte);

            TryRegisterAssembly();

            Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary
            {
                Source = new Uri("/MonoRemoteDebugger.VSExtension;component/Resources/Resources.xaml", UriKind.Relative)
            });

            InstallMenu();

            // Workaround: Don't show Visual Studio WPF DataBinding errors in Output window
            System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = System.Diagnostics.SourceLevels.Critical;
        }