public void ProcessEvent(IDEEvent e) { Asserts.That(e.TriggeredAt.HasValue); Asserts.That(e.TerminatedAt.HasValue); if (IsFocusGain(e)) { _hasFocus = true; } if (!_hasFocus) { return; } if (_cur == null) { _intervals.Add(_cur = _context.CreateIntervalFromEvent <VisualStudioActiveInterval>(e)); } _context.UpdateDurationForIntervalToMaximum(_cur, e.TerminatedAt.Value); if (IsFocusLost(e)) { EndCurrentInterval(e); } }
public void ProcessEvent(IDEEvent e) { Asserts.That(e.TriggeredAt.HasValue); Asserts.That(e.TerminatedAt.HasValue); /*if (e.TriggeredAt.Value > new DateTime(2016, 08, 19, 19, 17, 38)) * { * Console.WriteLine(); * }*/ if (e.ActiveDocument == null || e.TerminatedAt < _referenceTime) { // TODO include case: doc.Type != "CSharp" return; } if (IsTimedOut(e)) { _cur = null; } // untested ( if (_cur != null && (e is TestRunEvent || HasDocumentChanged(e))) { _context.UpdateDurationForIntervalToThis(_cur, e.TriggeredAt.Value); _cur = null; } // ) var classification = ClassifyEventType(e); if (classification.HasValue) { if (_cur == null) { CreateNewInterval(e, classification.Value); } else { TransformerUtils.SetDocumentTypeIfNecessary(_cur, e); // updates _cur.Project = _context.CurrentProject; // might not be available from the beginning if (_cur.Type == classification.Value) { // extend to max duration _context.UpdateDurationForIntervalToMaximum(_cur, e.TerminatedAt.Value); } else { // cut duration to current trigger point _context.UpdateDurationForIntervalToThis(_cur, e.TriggeredAt.Value); CreateNewInterval(e, classification.Value); } } } }
public void ProcessEvent(IDEEvent e) { Asserts.That(e.TriggeredAt.HasValue); Asserts.That(e.TerminatedAt.HasValue); var curEnd = e.TerminatedAt.Value; if (IsTimeout(e)) { curInt = null; } if (curInt == null) { _intervals.Add(curInt = _context.CreateIntervalFromEvent <UserActiveInterval>(e)); } _context.UpdateDurationForIntervalToMaximum(curInt, curEnd); }