void doneIconButton_Click(object sender, EventArgs e) { TodoistService todoistService = new TodoistService(); var cmdTimeGenerated = DateTime.Now; var tempID = Utils.DateTimeToUnixTimestamp(cmdTimeGenerated).ToString(); Project Project = new Project { name = projectNameTextBox.Text, color = ((int)ColorPickerListBox.SelectedItem), }; doneIconButton.IsEnabled = false; todoistService.AddProject(cmdTimeGenerated, Project, (data) => { app.projects.Insert(0, Project); Utils.DateTimeToUnixTimestamp(cmdTimeGenerated).ToString(); Project.id = data.TempIdMapping[tempID]; //MainTodoistPage.updateProjectList(data.Projects); MainTodoistPage.showMessage = (progress) => { Utils.ProgressIndicatorStatus(String.Format("\"{0}\" added.", Project.name), progress); }; }, (errorMsg) => { MessageBox.Show(Utils.Message(errorMsg), "Metroist", MessageBoxButton.OK); }, () => { doneIconButton.IsEnabled = true; var currentPage = app.RootFrame.Content as PhoneApplicationPage; if(currentPage == this) NavigationService.GoBack(); }); }