Example #1
0
        protected async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;
            try
            {
                if (UserTasksList == null)
                {
                    UserTasksList = new ObservableCollection <UserTaskViewModel>();
                }
                else
                {
                    UserTasksList.Clear();
                }

                int[] status =
                {
                    UserTaskStatus.Active, UserTaskStatus.Pending, UserTaskStatus.Paused, UserTaskStatus.Aborted
                };

                var userTasks = await _userTaskService.GetAllUserTaskByUserID(App.CurrentLogInUser.Email, status);

                foreach (var usertask in userTasks)
                {
                    var userTaskTime = await _userTaskService.GetUserTaskTimeByUserTaskId(usertask.UserTaskID);

                    UserTasksList.Add(new UserTaskViewModel(usertask, userTaskTime));
                }
            }
            finally
            {
                IsBusy = false;
            }
        }