コード例 #1
0
 public void Handle(TraceChangingEvent message)
 {
     _traceMessage = new StatusBarMessage(ActiveDocument, "Waiting for trace to update");
     _traceStatus  = message.TraceStatus;
     NotifyOfPropertyChange(() => CanRunQuery);
     NotifyOfPropertyChange(() => CanConnect);
 }
コード例 #2
0
 public void OnTraceStarted()
 {
     _status = QueryTraceStatus.Started;
     if (TraceStarted != null)
     {
         TraceStarted(this, null);
     }
 }
コード例 #3
0
 public void Handle(TraceChangedEvent message)
 {
     if (_traceMessage != null)
     {
         _traceMessage.Dispose();
     }
     _traceStatus = message.TraceStatus;
     NotifyOfPropertyChange(() => CanRunQuery);
     NotifyOfPropertyChange(() => CanConnect);
 }
コード例 #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);
        }
コード例 #5
0
 public TraceChangingEvent(QueryTraceStatus traceStatus)
 {
     TraceStatus = traceStatus;
 }
コード例 #6
0
 public void Stop()
 {
     _status = QueryTraceStatus.Stopping;
     queryTraceHubProxy.Invoke("Stop").Wait(3000); // TODO - do we need to timeout or force here if app is closing
     _status = QueryTraceStatus.Stopped;
 }
コード例 #7
0
ファイル: QueryTrace.cs プロジェクト: votrongdao/DaxStudio
        private void OnTraceEventInternal(object sender, TraceEventArgs e)
        {
            // we are using CommandBegin as a "heartbeat" to check if the trace
            // has started capturing events

            if (!_traceStarted)
            {
                StopTimer();
                _traceStarted = true;
                Status = QueryTraceStatus.Started;
                if (TraceStarted != null)
                    TraceStarted(this, new TraceStartedEventArgs());
            }
            else
            {
                OnTraceEvent(e);
                if (e.EventClass == TraceEventClass.QueryEnd)
                {
                    //Stop();
                    if (TraceCompleted != null)
                        TraceCompleted(this, null);
                }
            }
        }
コード例 #8
0
ファイル: QueryTrace.cs プロジェクト: votrongdao/DaxStudio
        public void Stop()
        {
            Status = QueryTraceStatus.Stopping;

            if (_trace != null)
            {
                _trace.OnEvent -= OnTraceEventInternal;
                try
                {
                    //    _trace.Stop();
                    _trace.Drop();
                    _trace = null;
                    Status = QueryTraceStatus.Stopped;
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e);
                }
            }

            _traceStarted = false;
        }
コード例 #9
0
ファイル: QueryTrace.cs プロジェクト: votrongdao/DaxStudio
        //private IResultsTarget _resultsTarget;
        public void Start()
        {
            if (_trace != null)
                if (_trace.IsStarted)
                    throw new InvalidOperationException("Cannot start a new trace as one is already running");

            if (Status != QueryTraceStatus.Started)
                Status = QueryTraceStatus.Starting;

            _trace = GetTrace();
            SetupTrace(_trace);
            _trace.Start();

            // create timer to "ping" the server with DISCOVER_SESSION requests
            // until the trace events start to fire.
            if (_startingTimer == null)
                _startingTimer = new Timer();
            _startingTimer.Interval = 300;  //TODO - make time interval shorter
            _startingTimer.Elapsed += OnTimerElapsed;
            _startingTimer.Enabled = true;
            _startingTimer.Start();
            utcPingStart = DateTime.UtcNow;
            // Wait for Trace to become active
        }
コード例 #10
0
        //public void Clear()
        //{
        //    _trace.Events.Clear();
        //}
        public void Start()
        {
            if (_trace != null)
                if (_trace.IsStarted || Status == QueryTraceStatus.Starting )
                    return; // if the trace is already running exit here

            if (Status != QueryTraceStatus.Started)  Status = QueryTraceStatus.Starting;
            _connection = new ADOTabular.ADOTabularConnection(_connectionString, _connectionType);
            _connection.Open();
            _trace = GetTrace();
            SetupTrace(_trace, _eventsToCapture);
            _trace.Start();

            // create timer to "ping" the server with DISCOVER_SESSION requests
            // until the trace events start to fire.
            if (_startingTimer == null)
                _startingTimer = new Timer();
            _startingTimer.Interval = 300;  //TODO - make time interval shorter?
            _startingTimer.Elapsed += OnTimerElapsed;
            _startingTimer.Enabled = true;
            _startingTimer.Start();
            utcPingStart = DateTime.UtcNow;
            // Wait for Trace to become active
        }
コード例 #11
0
 private void OnTraceEventInternal(object sender, xlAmo.TraceEventArgs e)
 {
     // we are using CommandBegin as a "heartbeat" to check if the trace
     // has started capturing events
     if (!_traceStarted)
     {
         StopTimer();
         _traceStarted = true;
         Status = QueryTraceStatus.Started;
         if (TraceStarted != null)
             TraceStarted(this,  null);
     }
     else
     {
         //OnTraceEvent(e);
         _capturedEvents.Add( CreateTraceEventArg(e));
         if (e.EventClass == xlAmo.TraceEventClass.QueryEnd)
         {
             // Raise an event with the captured events
             if (TraceCompleted != null)
                 TraceCompleted(this, _capturedEvents);
             // reset the captured events collection
             _capturedEvents = new List<DaxStudioTraceEventArgs>();
         }
     }
 }
コード例 #12
0
 public TraceChangedEvent(QueryTraceStatus traceStatus)
 {
     TraceStatus = traceStatus;
 }
コード例 #13
0
 public void OnTraceStarted() {
     _status = QueryTraceStatus.Started;
     if (TraceStarted != null)
     { TraceStarted(this, null); }
 }
コード例 #14
0
 public void Stop()
 {
     _status = QueryTraceStatus.Stopping;
     queryTraceHubProxy.Invoke("Stop").Wait();
     _status = QueryTraceStatus.Stopped;
 }
コード例 #15
0
 private void OnTraceEventInternal(object sender, TraceEventArgs e)
 {
     // we are using CommandBegin as a "heartbeat" to check if the trace
     // has started capturing events
     if (!_traceStarted)
     {
         StopTimer();
         _traceStarted = true;
         Status = QueryTraceStatus.Started;
         if (TraceStarted != null)
             TraceStarted(this,  null);
     }
     else
     {
         System.Diagnostics.Debug.Print("TraceEvent: {0}", e.EventClass.ToString());
         OnTraceEvent(e);
         _capturedEvents.Add(new DaxStudioTraceEventArgs(e));
         if (e.EventClass == TraceEventClass.QueryEnd)
         {
             // Raise an event with the captured events
             if (TraceCompleted != null)
                 TraceCompleted(this, _capturedEvents);
             // reset the captured events collection
             _capturedEvents = new List<DaxStudioTraceEventArgs>();
         }
     }
 }
コード例 #16
0
        public void Start()
        {
            try
            {
                if (_trace != null)
                    if (_trace.IsStarted || Status == QueryTraceStatus.Starting)
                        return; // exit here if trace is already started

                if (Status != QueryTraceStatus.Started)  Status = QueryTraceStatus.Starting;
                Log.Verbose("{class} {method} {event}", "QueryTraceEngine", "Start", "Connecting to: " + _connectionString);
                _connection = new ADOTabular.ADOTabularConnection(_connectionString, _connectionType);
                _connection.Open();
                _trace = GetTrace();
                SetupTrace(_trace, _eventsToCapture);
                _trace.Start();

                // create timer to "ping" the server with DISCOVER_SESSION requests
                // until the trace events start to fire.
                if (_startingTimer == null)
                    _startingTimer = new Timer();
                _startingTimer.Interval = 300;  //TODO - make time interval shorter?
                _startingTimer.Elapsed += OnTimerElapsed;
                _startingTimer.Enabled = true;
                _startingTimer.Start();
                utcPingStart = DateTime.UtcNow;
                // Wait for Trace to become active
            }
            catch (Exception ex)
            {
                Log.Error("{class} {method} {message}","QueryTraceEngine" , "Start", ex.Message);
            }
        }