public void Handle(ActivateDocumentEvent message)
 {
     if (message.Document == null)
     {
         return;
     }
     // remove handler for previous active document
     if (ActiveDocument != null)
     {
         ActiveDocument.PropertyChanged -= ActiveDocument_PropertyChanged;
     }
     // set new active document
     ActiveDocument = message.Document;
     // add property changed handler for new document
     ActiveDocument.PropertyChanged += ActiveDocument_PropertyChanged;
     TimerText = message.Document.ElapsedQueryTime;
     NotifyOfPropertyChange(() => TimerText);
     NotifyOfPropertyChange(() => ActiveDocument);
     Spid          = ActiveDocument.Spid.ToString();
     ServerName    = ActiveDocument.ServerName;
     ServerVersion = ActiveDocument.ServerVersion;
     TimerText     = ActiveDocument.ElapsedQueryTime;
     Message       = ActiveDocument.StatusBarMessage;
     RowCount      = ActiveDocument.RowCount;
 }
Beispiel #2
0
        public virtual void OnActivateDocumentEvent(IDebugDocumentContext2 documentContext,
                                                    IDebugDocument2 document = null)
        {
            Logger.Debug(string.Empty);
            var eventObject = new ActivateDocumentEvent(documentContext, document);

            OnDebugEvent(eventObject, InterfaceGuids.IActivateDocumentEvent2Guid);
        }
 public void Handle(ActivateDocumentEvent message)
 {
     _document = message.Document;
     if (_host.IsExcel)
     {
         // refresh workbooks and worksheet properties if the host is excel
         SelectedWorkbook  = _host.Proxy.WorkbookName;
         SelectedWorksheet = message.Document.SelectedWorksheet;
         NotifyOfPropertyChange(() => Worksheets);
     }
 }
Beispiel #4
0
        public void Handle(ActivateDocumentEvent message)
        {
            Log.Debug("{Class} {Event} {Document}", "RibbonViewModel", "Handle:ActivateDocumentEvent", message.Document.DisplayName);
            _isDocumentActivating = true;
            ActiveDocument        = message.Document;
            var doc = ActiveDocument;

            SelectedTarget = ActiveDocument.SelectedTarget;

            _queryRunning = ActiveDocument.IsQueryRunning;
            if (ActiveDocument.Tracer == null)
            {
                _traceStatus = QueryTraceStatus.Stopped;
            }
            else
            {
                _traceStatus = ActiveDocument.Tracer.Status;
            }
            NotifyOfPropertyChange(() => CanRunQuery);
            NotifyOfPropertyChange(() => CanCancelQuery);
            NotifyOfPropertyChange(() => CanClearCache);
            NotifyOfPropertyChange(() => CanRefreshMetadata);
            NotifyOfPropertyChange(() => CanConnect);
            if (!ActiveDocument.IsConnected)
            {
                UpdateTraceWatchers();
                NotifyOfPropertyChange(() => TraceWatchers);
                NotifyOfPropertyChange(() => ServerTimingsChecked);
                NotifyOfPropertyChange(() => ServerTimingDetails);
                return;
            }
            try
            {
                RefreshConnectionDetails(ActiveDocument, ActiveDocument.SelectedDatabase);
                // TODO - do we still need to check trace watchers if we are not connected??
                UpdateTraceWatchers();
            }
            catch (AdomdConnectionException ex)
            {
                Log.Error("{class} {method} {Exception}", "RibbonViewModel", "Handle(ActivateDocumentEvent)", ex);
                doc.OutputError(ex.Message);
            }
            finally
            {
                _isDocumentActivating = false;
            }
            NotifyOfPropertyChange(() => TraceWatchers);
            NotifyOfPropertyChange(() => ServerTimingsChecked);
            NotifyOfPropertyChange(() => ServerTimingDetails);
        }
Beispiel #5
0
 public void Handle(ActivateDocumentEvent message)
 {
     _isPowerBIOrSSDTConnection = message.Document.Connection?.IsPowerBIorSSDT ?? false;
     NotifyOfPropertyChange(() => IsEnabled);
     _eventAggregator.PublishOnUIThread(new RefreshOutputTargetsEvent());
 }