void doneIconButton_Click(object sender, EventArgs e) { TodoistService todoistService = new TodoistService(); var cmdTimeGenerated = DateTime.Now; var tempID = Utils.DateTimeToUnixTimestamp(cmdTimeGenerated); projSelected.name = projectNameTextBox.Text; projSelected.color = ((int)ColorPickerListBox.SelectedItem); todoistService.EditProject(cmdTimeGenerated, projSelected, (data) => { todoistService.GetData( (fullData) => { var updatedProject = fullData.Projects.Where(x => x.id == projSelected.id).First(); UpdateContext(); MainTodoistPage.updateAll(fullData); ProjectDetail.showMessage = (progress) => { ProjectDetail.projectSelected = updatedProject; Utils.ProgressIndicatorStatus(String.Format("\"{0}\" changed.", projSelected.name), progress); }; }, (error) => { MessageBox.Show(Utils.Message(error), "Metroist", MessageBoxButton.OK); }, () => { NavigationService.GoBack(); }); }, (errorMsg) => { MessageBox.Show(Utils.Message(errorMsg), "Metroist", MessageBoxButton.OK); }); }
void doneButton_Click(object sender, EventArgs e) { TodoistService todoistService = new TodoistService(); var commandTimeGenerated = DateTime.Now; Item Task = new Item { content = ContentTextBox.Text, date_string = DateStringTextBox.Text, project_id = projectSelected.id }; doneButton.IsEnabled = false; todoistService.AddTaskToProject(commandTimeGenerated, Task, (data) => { todoistService.GetData( (fullData) => { app.projects = fullData.Projects; app.notes = fullData.Notes; app.items = fullData.Items; var tempID = Utils.DateTimeToUnixTimestamp(commandTimeGenerated).ToString(); Task.id = data.TempIdMapping[tempID]; Task = app.items.Where(x => x.id == Task.id).FirstOrDefault(); MainTodoistPage.updateProjectList(fullData.Projects); ProjectDetail.showMessage = (progress) => { Utils.ProgressIndicatorStatus(String.Format("\"{0}\" added.", Task.content), progress); ProjectDetail.showMessage = null; }; }, (errorMessage) => { }, () => { doneButton.IsEnabled = true; var currentPage = app.RootFrame.Content as PhoneApplicationPage; if (currentPage == this) NavigationService.GoBack(); }); }, (errorMsg) => { MessageBox.Show(Utils.Message(errorMsg), "Metroist", MessageBoxButton.OK); }); //NavigationService.GoBack(); }