Пример #1
0
        async Task ExecuteNewPomodoroCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                LoadingMessage = "Adding New Pomodoro...";
                IsBusy         = true;
                var coffee = await pomodoroCupService.AddPomodoro(HardPomodoro);

                Pomodoros.Add(coffee);
                SortPomodoros();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error in Add  Pomodor: " + ex);
            }
            finally
            {
                LoadingMessage = string.Empty;
                IsBusy         = false;
            }
        }
Пример #2
0
        async Task ExecuteLoadPomodoroCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                LoadingMessage = "Loading Pomodoros...";
                IsBusy         = true;
                var pomodoros = await pomodoroCupService.GetPomodoros();

                Pomodoros.ReplaceRange(pomodoros);
                SortPomodoros();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error Loading Pomodoros: !" + ex);

                await Application.Current.MainPage.DisplayAlert("Sync Error", "Unable to sync coffees, you may be offline", "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #3
0
 private void LoadControls()
 {
     Working.AddRange(new short[] { 5, 10, 15, 20, 25, 30, 45, 60 });
     ShortBreaks.AddRange(new short[] { 5, 10, 15, 20, 25, 30, 45, 60 });
     LongBreaks.AddRange(new short[] { 5, 10, 15, 20, 25, 30, 45, 60 });
     Pomodoros.AddRange(new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
 }
Пример #4
0
        public IQueryable <Pomodoro> GetMyPomodoros(IPrincipal User)
        {
            ApplicationUser currentUser = GetUser(User.Identity);

            if (currentUser == null)
            {
                return(Enumerable.Empty <Pomodoro>().AsQueryable());
            }
            return(Pomodoros.Where(p => p.Action.Task.Project.User.Id == currentUser.Id));
        }
 private async void ClearListCommandExecute()
 {
     if (Pomodoros != null)
     {
         Application.Current.Properties.Clear();
         Pomodoros.Clear();
         await Application.Current.SavePropertiesAsync();
     }
     else
     {
         await Application.Current.MainPage.DisplayAlert(
             AppResources.title_error_alert,
             AppResources.message_error_clear_lista,
             AppResources.ok);
     }
 }