private static void OnWindowClosed(ref DateTime startTime, EventWindow window) { if (startTime == DateTime.MinValue) { startTime = window.StartTime; } TimeSpan relativeStartTime = window.StartTime - startTime; int pending = window.GetPendingCount(1); int completed = window.GetCompletedCount(1); Console.WriteLine("{0:0.000},{1},{2}", relativeStartTime.TotalSeconds, pending, completed); }
public void CloseWindow() { if (this.window != null) { EventWindow closedWindow = this.window; this.window = null; EventHandler <WindowEventArgs> handler = this.WindowClosed; if (handler != null) { handler(this, new WindowEventArgs(closedWindow)); } } }
public void CloseWindow() { if (this.window != null) { EventWindow closedWindow = this.window; this.window = null; EventHandler<WindowEventArgs> handler = this.WindowClosed; if (handler != null) { handler(this, new WindowEventArgs(closedWindow)); } } }
private void EnsureWindow(DateTime timestamp) { if (this.window == null) { this.window = new EventWindow(timestamp); } else { TimeSpan delta = timestamp - this.window.StartTime; int secondsAfter = (int)delta.TotalSeconds; if (secondsAfter > 0) { DateTime nextStartTime = this.window.StartTime + TimeSpan.FromSeconds(secondsAfter); EventWindow nextWindow = new EventWindow(this.window, nextStartTime); nextWindow.ClearCompleted(); this.CloseWindow(); this.window = nextWindow; } } }
public WindowEventArgs(EventWindow window) { this.Window = window; }
public EventWindow(EventWindow other, DateTime startTime) { this.pending = DeepCopy(other.pending); this.completed = new Dictionary<int, int>(other.completed); this.StartTime = startTime; }
public EventWindow(EventWindow other, DateTime startTime) { this.pending = DeepCopy(other.pending); this.completed = new Dictionary <int, int>(other.completed); this.StartTime = startTime; }