private void SetMyMood() { Console.WriteLine("Set my mood"); var mood = Mood.Read(currentMood.Id); Console.WriteLine("Setting my mood to " + mood.Name); MoodResponse response = MoodResponse.New(); if (CurrentPrompt == null) { response.Id = System.Guid.NewGuid().ToString(); response.TimeStamp = DateTime.UtcNow; } else { response = CurrentPrompt.Response; } response.Mood = mood; response.CreatedOn = DateTime.UtcNow; response.Save(); Console.WriteLine("Mood response saved"); var app = ApplicationState.Current; if (app.RunningMode != RunningMode.Normal) { app.RunningMode = RunningMode.Normal; app.Save(); } MyMoodLogger.Current.Log("Mood Response - " + mood.Name, CurrentPrompt == null ? "No prompt" : "Prompt: " + CurrentPrompt.Title, 2); //NSNotificationCenter.DefaultCenter.PostNotificationName("SyncDataAndNotifications",null); Console.WriteLine("Lets create a thread for pushing response"); System.Threading.Tasks.Task.Factory.StartNew(() => { //NSTimer.CreateScheduledTimer (5, delegate { Console.WriteLine("Submit response to server"); MyMoodService.Current.SubmitMoodResponse(response); Console.WriteLine("Mood response submitted"); //}); }); if (CurrentPrompt != null) { Console.WriteLine("Cancel notification"); //if we have gone vie the timeline then we need to cancel the prompt so the user doesn't select it again from the notification drop down NotificationManager.CancelLocalNotification(CurrentPrompt); Console.WriteLine("Update badge numbers"); //decrease mood prompt badges UIApplication.SharedApplication.ApplicationIconBadgeNumber = MoodPrompt.GetOutstandingPrompts().Count(); //UIApplication.SharedApplication.ApplicationIconBadgeNumber = UIApplication.SharedApplication.ApplicationIconBadgeNumber -1; } CurrentPrompt = null; Console.WriteLine("Done with setting mood - navigate back"); this.NavigationController.PopViewControllerAnimated(true); }