public void OnCallback(SchedulerStateDto schedulerStateDto) { Action <SchedulerStateDto> handlers = Updated; handlers? .GetInvocationList() .Cast <Action <SchedulerStateDto> >() .ForEach(e => e.BeginInvoke(schedulerStateDto, null, null)); }
private static void OnUpdated(SchedulerStateDto dto) { if (dto.Cycle % 128 != 0) { return; } Console.Clear(); Console.SetCursorPosition(0, 0); Console.WriteLine($"Cycle: {dto.Cycle.ToString("d3")} Instance: {dto.InstanceId} UpTime: {dto.UpTime}"); if (dto.SpotManagerState != null) { Console.WriteLine($"Spot Manager Tick: {dto.SpotManagerState.Tick}"); Console.WriteLine($"Charging Spots: {dto.SpotManagerState.ChargingSpotStates.Count()}"); dto.SpotManagerState.ChargingSpotStates.ForEach(e => Console.WriteLine($"{e.ToChargingSpotStateString()}")); Console.WriteLine($"Parking Spots: {dto.SpotManagerState.ParkingSpotStates.Count()}"); dto.SpotManagerState.ParkingSpotStates.ForEach(e => Console.WriteLine($"{e.ToParkingSpotStateString()}")); } }
private void Callback_Updated(SchedulerStateDto schedulerState) { SchedulerState = schedulerState; }