void checkUncheckButton_Click(object sender, EventArgs e) { TodoistService todoistService = new TodoistService(); var cmdTime = DateTime.Now; Item selected = Task as Item; selected.selectedListBoxItem_ProjectDetail = true; if (selected != null) { var project = (from proj in app.projects where proj.id == Task.project_id select proj).FirstOrDefault(); if (project != null) { if (!selected.is_checked) { project.cache_count--; selected.is_checked = true; } else { project.cache_count++; selected.is_checked = false; } } //Update icon to Unchecked var newButton = (sender as ApplicationBarIconButton); newButton.IconUri = new Uri("/Images/" + (selected.is_checked ? "Uncheck.png" : "Check.png"), UriKind.Relative); newButton.Text = selected.is_checked ? "uncheck" : "check done"; DataContext = null; DataContext = Task; //--> todoistService.SetTaskAsChecked(cmdTime, selected, (data) => { if (MainTodoistPage.updateProjectList != null) MainTodoistPage.updateProjectList(data.Projects); }, (erroMsg) => { //@TODO: What to do here? error method MessageBox.Show(erroMsg, "Metroist", MessageBoxButton.OK); }, () => { }); } }
private void CompleteTask_Click(object sender, RoutedEventArgs e) { TodoistService todoistService = new TodoistService(); var cmdTime = DateTime.Now; Item selected = UncompletedTasksListBox.SelectedItem as Item; selected.selectedListBoxItem_ProjectDetail = true; if (selected != null) { projectSelected.cache_count--; selected.is_checked = true; todoistService.SetTaskAsChecked(cmdTime, selected, (data) => { if (MainTodoistPage.updateProjectList != null) MainTodoistPage.updateProjectList(data.Projects); }, (erroMsg) => { //@TODO: What to do here? error method }, () => { }); } }