Ejemplo n.º 1
0
        public void DeleteTask(Task task)
        {
            var taskToDelete = this.GetTask(task);
            this.AllTasks.Remove(taskToDelete);

            this.SaveStore();
        }
Ejemplo n.º 2
0
        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;
                });
        }
Ejemplo n.º 3
0
        public void SaveTask(Task task)
        {
            if (!this.AllTasks.Contains(task))
            {
                this.AllTasks.Add(task);
            }

            this.SaveStore();
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 7
0
 public Task GetTask(Task task)
 {
     return this.AllTasks.Where(a => task.Id == a.Id).FirstOrDefault();
 }
Ejemplo n.º 8
0
 public IObservable<Task> PostponeTask(Task task)
 {
     throw new NotImplementedException();
 }