示例#1
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)
            {
                Log.Debug("{class} {mothod} Pending TraceEvent: {eventClass}", "QueryTraceEngineExcel", "OnTraceEventInternal", e.EventClass.ToString());
                StopTimer();
                _traceStarted = true;
                _connection.Close(false);
                _connection.Dispose();
                _connection = null;
                Status      = QueryTraceStatus.Started;
                TraceStarted?.Invoke(this, null);

                var f = new System.IO.FileInfo(_trace.Parent.Name);
                _friendlyServerName = f.Name;
            }
            else
            {
                Log.Debug("{class} {method} TraceEvent: {eventClass}", "QueryTraceEngineExcel", "OnTraceEventInternal", e.EventClass.ToString());
                //OnTraceEvent(e);
                _capturedEvents.Add(CreateTraceEventArg(e, _friendlyServerName));
                if (e.EventClass == xlAmo.TraceEventClass.QueryEnd)
                {
                    // Raise an event with the captured events
                    TraceCompleted?.Invoke(this, _capturedEvents);
                    // reset the captured events collection
                    _capturedEvents = new List <DaxStudioTraceEventArgs>();
                }
            }
        }
示例#2
0
        public void SetTraceTimer(HackStartInfo hack, double traceTime)
        {
            var trace = new TraceTimer
            {
                TimeLeft = traceTime,
                Hack     = hack
            };

            _traceTimers.Add(trace);

            TraceStarted?.Invoke();
        }