void deleteIconButton_Click(object sender, EventArgs e) { TodoistService todoistService = new TodoistService(); var result = MessageBox.Show(string.Format("Delete project \"{0}\"?", projectSelected.name), "Metroist", MessageBoxButton.OKCancel); //@TODO: check what is the answers. if the deleted projects come also. if (result == MessageBoxResult.OK) { var cmdTimeGenerated = DateTime.Now; var tempID = Utils.DateTimeToUnixTimestamp(cmdTimeGenerated).ToString(); //if (projectSelected.last_updated == 0.0) if (projectSelected.id == null) { //@TODO: Check if there is a unsynchroned project with the same name. //There isn't another way to check if the project wasn't sync instead of checking by name //I will assume that the user never create a project with two names intentionally. } else { deleteIconButton.IsEnabled = false; todoistService.RemoveProject(cmdTimeGenerated, projectSelected, (data) => { app.projects.Remove(projectSelected); MainTodoistPage.showMessage = (progress) => { Utils.ProgressIndicatorStatus(String.Format("\"{0}\" deleted.", projectSelected.name), progress); }; }, (errorMsg) => { MessageBox.Show(Utils.Message(errorMsg), "Metroist", MessageBoxButton.OK); }, () => { deleteIconButton.IsEnabled = true; var currentPage = app.RootFrame.Content as PhoneApplicationPage; if (currentPage == this) NavigationService.GoBack(); }); } } }