private void TimerHandlerDeleted(TimerHandlerDto data) { if (data == null) return; var x = ItemsCollection.FirstOrDefault(e => e.TimerHandlerId == data.TimerHandlerId); if (x == null) return; ItemsCollection.Remove(x); }
private async void TimerHandlerUpdated(TimerHandlerDto data) { if (data == null) return; var x = ItemsCollection.FirstOrDefault(e => e.TimerHandlerId == data.TimerHandlerId); if (x == null) return; SetIsBusy(true); var handler = await _diteService.GetTimerHandler(data.TimerHandlerId); handler.CopyProperties(x); SetIsBusy(false); }
private void TimerStarted(TimerHandlerDto data) { if (data == null) return; foreach (var result in ItemsCollection.Where(e => e.IsRunning)) result.IsRunning = false; var handler = ItemsCollection.FirstOrDefault(e => e.TimerHandlerId == data.TimerHandlerId); if (handler == null) return; handler.IsRunning = data.IsRunning; CurrentItem = handler; }
private async Task RefreshTimers() { SetIsBusy(true); //get all timers var result = await _diteService.GetTimerHandlers(); ItemsCollection.Clear(); result.ForEach(e => ItemsCollection.Add(e)); CurrentItem = result.FirstOrDefault(e => e.IsRunning); SetIsBusy(false); }
private void TimerHandlerInserted(TimerHandlerDto data) { ItemsCollection.Add(data); }
/// <summary> /// Execute NewItem /// </summary> private async void ExecuteNewItem(object p) { //add new var timer = new TimerHandlerDto(); timer.TimerHandlerId = Guid.NewGuid(); timer.Name = Name; SetIsBusy(true); var post = await _diteService.NewTimerHandler(timer); SetIsBusy(false); // go to edit var controller = await _moduleFactory.CreateController(Modules.TimerHandler); /* var controller = await _moduleFactory.CreateController(Modules.TimerHandler); await controller.ViewModel.LoadAsync(post.TimerHandlerId); await _navigation.OpenController(this, controller); */ //await _navigation.OpenModule(this, Modules.TimerHandler, post.TimerHandlerId); await _navigationService.OpenModule<HandlerPageController>(this, post.TimerHandlerId, true); }