Exemplo n.º 1
0
 public Recorder(IServiceProvider serviceProvider)
 {
     Validate.IsNotNull(serviceProvider, "serviceProvider");
     this.serviceProvider = serviceProvider;
     dataModel = new RecorderDataModel();
     this.activationWatcher = this.activationWatcher ?? new WindowActivationWatcher(serviceProvider: this.serviceProvider, dataModel: this.dataModel);
 }
        internal WindowActivationWatcher(IServiceProvider serviceProvider, RecorderDataModel dataModel)
        {
            Validate.IsNotNull(serviceProvider, "serviceProvider");
            Validate.IsNotNull(dataModel, "dataModel");

            this.serviceProvider = serviceProvider;
            this.dataModel = dataModel;

            var monSel = (IVsMonitorSelection)this.serviceProvider.GetService(typeof(SVsShellMonitorSelection));
            if (monSel != null)
            {
                // NOTE: We can ignore the return code here as there really isn't anything reasonable we could do to deal with failure,
                // and it is essentially a no-fail method.
                monSel.AdviseSelectionEvents(pSink: this, pdwCookie: out this.monSelCookie);
            }
            this.macroRecorder = (IRecorderPrivate)serviceProvider.GetService(typeof(IRecorder));
        }