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); } } } }
private void EndCurrentInterval(IIDEEvent e = null) { if (e != null) { Asserts.That(e.TriggeredAt.HasValue); _context.UpdateDurationForIntervalToThis(_cur, e.TriggeredAt.Value); } _hasFocus = false; _cur = null; }