private void FilterEventsByDate() { var filteredEvents = Events.Where(t => t.StartDateTime.Date <= selDate.Date && t.FinishDateTime.Date >= selDate.Date); filteredEvents.OrderBy(t => t.StartDateTime.Date); CurrentEvents.Clear(); foreach (var i in filteredEvents) { CurrentEvents.Add(i); } }
private static List <IEvent> SendInput_Flatten(this IEnumerable <IEvent> This, SendInputOptions Options) { var MaxItemsPerBatch = Math.Max(1, Options.BatchSize); var BatchDelay = Options.BatchDelay > TimeSpan.Zero ? Options.BatchDelay : TimeSpan.Zero; var BatchDelayItem = BatchDelay > TimeSpan.Zero ? new Wait(BatchDelay) : default; var Linear = new List <IEvent>(); var CurrentEvents = new List <IEvent>(); var CurrentInputs = new List <IReadOnlyCollection <INPUT> >(); void WrapUp() { if (CurrentEvents.Count > 0) { var InputList = CurrentInputs.SelectMany(x => x).ToArray(); Linear.Add(new RawInputAggregate(CurrentEvents, InputList)); CurrentEvents = new List <IEvent>(); CurrentInputs = new List <IReadOnlyCollection <INPUT> >(); } } foreach (var CurrentEvent in This) { if (CurrentEvent is IEnumerable <IEvent> E) { var RecursiveChildren = E.RecursiveChildren().ToList(); if (RecursiveChildren.TrueForAll(x => x is RawInput)) { CurrentEvents.Add(CurrentEvent); foreach (var RecursiveChild in RecursiveChildren.OfType <RawInput>().Select(x => x.Data)) { CurrentInputs.Add(RecursiveChild); if (CurrentInputs.Count >= MaxItemsPerBatch) { WrapUp(); CurrentEvents.Add(CurrentEvent); if (BatchDelayItem is { })