Beispiel #1
0
 public NoSourceWindowHider(JoinableTaskContext taskContext,
                            IServiceProvider serviceProvider,
                            IExceptionRecorder exceptionRecorder, YetiVSIService vsiService)
 {
     taskContext.ThrowIfNotOnMainThread();
     _taskContext       = taskContext;
     _serviceProvider   = serviceProvider;
     _exceptionRecorder = exceptionRecorder;
     _vsiService        = vsiService;
     _debuggerEvents    = GetDte().Events.DebuggerEvents;
 }
        object CreateService(IServiceContainer container, Type serviceType)
        {
            _taskContext.ThrowIfNotOnMainThread();

            if (typeof(YetiVSIService) == serviceType)
            {
                var options = GetDialogPage(typeof(OptionPageGrid)) as OptionPageGrid;
                var yeti = new YetiVSIService(options);
                yeti.DebuggerOptions.ValueChanged += OnDebuggerOptionChanged;
                return yeti;
            }

            if (typeof(SLLDBShell) == serviceType)
            {
                var writer = new CommandWindowWriter(_taskContext,
                                                     (IVsCommandWindow) GetService(
                                                         typeof(SVsCommandWindow)));
                return new LLDBShell.LLDBShell(_taskContext, writer);
            }

            if (typeof(SMetrics) == serviceType)
            {
                return new MetricsService(_taskContext,
                                          Versions.Populate(
                                              (GetService(typeof(EnvDTE.DTE)) as EnvDTE._DTE)
                                              ?.RegistryRoot));
            }

            if (typeof(SDebugEngineManager) == serviceType)
            {
                return new DebugEngineManager();
            }

            if (typeof(SSessionNotifier) == serviceType)
            {
                ISessionNotifier sessionNotifier = new SessionNotifierService();
                var vsiService = (YetiVSIService) GetGlobalService(typeof(YetiVSIService));
                var exceptionRecorder =
                    new ExceptionRecorder((IMetrics) GetService(typeof(SMetrics)));
                var loadSymbolsCommand = new LoadSymbolsCommand(
                    _taskContext, this, exceptionRecorder, vsiService);
                sessionNotifier.SessionLaunched += loadSymbolsCommand.OnSessionLaunched;
                sessionNotifier.SessionStopped += loadSymbolsCommand.OnSessionStopped;

                var noSourceWindowHider = new NoSourceWindowHider(_taskContext, this,
                                                                  exceptionRecorder, vsiService);
                sessionNotifier.SessionLaunched += noSourceWindowHider.OnSessionLaunched;
                sessionNotifier.SessionStopped += noSourceWindowHider.OnSessionStopped;

                return sessionNotifier;
            }

            return null;
        }