Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 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));
         }
     }
 }
Exemple #5
0
 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;
         }
     }
 }
 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;
 }
Exemple #8
0
 public EventWindow(EventWindow other, DateTime startTime)
 {
     this.pending = DeepCopy(other.pending);
     this.completed = new Dictionary<int, int>(other.completed);
     this.StartTime = startTime;
 }
Exemple #9
0
 public WindowEventArgs(EventWindow window)
 {
     this.Window = window;
 }
Exemple #10
0
 public EventWindow(EventWindow other, DateTime startTime)
 {
     this.pending   = DeepCopy(other.pending);
     this.completed = new Dictionary <int, int>(other.completed);
     this.StartTime = startTime;
 }