예제 #1
0
        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);
        }
예제 #2
0
 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);
 }
예제 #3
0
        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;
        }
예제 #4
0
 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);
 }
예제 #5
0
 private void TimerHandlerInserted(TimerHandlerDto data)
 {
     ItemsCollection.Add(data);
 }
예제 #6
0
        /// <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);
        }