private async Task LoadPersistedConfiguration() { var payload = await WidgetStateRepository.Get(ChannelName, WidgetName); if (payload.Count == 0) { return; } FirstEventTime = DateTime.Parse(payload[nameof(FirstEventTime)]); LastEventTime = DateTime.Parse(payload[nameof(LastEventTime)]); Counter = (TimeRemaining.TotalSeconds > 0) ? int.Parse(payload[nameof(Counter)]) : 0; if (TimeRemaining.TotalSeconds > 0) { RestorePositionOfTrain(); TrainTimer.Interval = TimeRemaining.TotalMilliseconds; TrainTimer.Start(); await InvokeAsync(StateHasChanged); } }
public WidgetStatesController(WidgetStateRepository widgetStateRepository) { _widgetStateRepository = widgetStateRepository; }