Exemple #1
0
        public void DeleteTask(Task task)
        {
            var taskToDelete = this.GetTask(task);
            this.AllTasks.Remove(taskToDelete);

            this.SaveStore();
        }
        public IObservable<TaskCompletedSummary> PostponeTask(Task task)
        {
            return this._rtmServiceClientFactory()
                .PostponeTask(task)
                .Select(commitedTask => {
                    var taskStore = this._taskStoreLocator.GetStore();
                    taskStore.SaveTask(commitedTask);

                    return new TaskCompletedSummary {
                        Task = CompleteTaskTask,
                        Result = TaskSummaryResult.Success,
                        Context = commitedTask.Id
                    };
                })
                .Catch((Exception exception) => {
                    if (exception is WebException)
                    {
                        var webException = exception as WebException;
                        var summary = ExceptionHandling.GetSummaryFromWebException(GetTasksTask, webException);
                        return Observable.Return(summary);
                    }

                    if (exception is UnauthorizedAccessException)
                    {
                        return Observable.Return(new TaskCompletedSummary { Task = GetTasksTask, Result = TaskSummaryResult.AccessDenied });
                    }

                    throw exception;
                });
        }
Exemple #3
0
        public void SaveTask(Task task)
        {
            if (!this.AllTasks.Contains(task))
            {
                this.AllTasks.Add(task);
            }

            this.SaveStore();
        }
 public static string GetCompleteTaskRequest(string apiKey, string sharedSecret, string token, string timeline, Task task)
 {
     var parameters = new Dictionary<string, string>();
     parameters.Add("timeline", timeline);
     parameters.Add("method", "rtm.tasks.complete");
     parameters.Add("task_id", task.Id);
     parameters.Add("taskseries_id", task.TaskSeriesId);
     parameters.Add("list_id", task.ListId);
     return BuildRequest(apiKey, sharedSecret, token, parameters);
 }
        public IObservable<Task> CompleteTask(Task task)
        {
            var url = RtmRequestBuilder.GetCompleteTaskRequest(
                Constants.ApiKey, Constants.SharedSecret, _settingsStore.AuthorizationToken, _timeline, task);

            //TODO: The task completes correctly in RTM but the response does not seem to be caught!
            return HttpClient
                .RequestTo(url)
                .GetRest<RtmUpdateTaskResponse>()
                .Select(ToTask);
        }
Exemple #6
0
        public TaskViewModel(Task taskItem, DelegateCommand viewTaskCommand,
            INavigationService navigationService, ISynchronizationService synchronizationService)
            : base(navigationService)
        {
            this.TaskItem = taskItem;

            this._synchronizationService = synchronizationService;

            this.MarkCompleteCommand = new DelegateCommand(MarkCompleteCommandDelegate);
            this.MarkPostponeCommand = new DelegateCommand(MarkPostponeCommandDelegate);
            this.ViewTaskCommand = viewTaskCommand;
            this.EditTaskCommand = new DelegateCommand(EditTaskCommandDelegate); ;

            this.IsBeingActivated();
        }
Exemple #7
0
 public Task GetTask(Task task)
 {
     return this.AllTasks.Where(a => task.Id == a.Id).FirstOrDefault();
 }
 public IObservable<Task> PostponeTask(Task task)
 {
     throw new NotImplementedException();
 }