/// <summary>
 /// Check survey, throws exception if it's invalid
 /// </summary>
 /// <param name="s"></param>
 /// <returns>true if is fine and use it, false to ignore it</returns>
 public bool CheckSurvey(Survey s)
 {
     if (!string.IsNullOrEmpty(s.Question))
     {
         if (string.IsNullOrEmpty(s.Answers[0]) || string.IsNullOrEmpty(s.Answers[1]))
         {
             throw new Exception(Resources.Labels.InvalidSurvey);
         }
         //remove nulls from array
         List<string> answers = new List<string>();
         foreach (string ans in s.Answers)
         {
             if (!string.IsNullOrEmpty(ans))
             {
                 answers.Add(ans);
             }
         }
         s.Answers = answers.ToArray();
     }
     else
     {                
         bool anything = !string.IsNullOrEmpty(s.Question);
         foreach(string item in s.Answers){
             anything |= !string.IsNullOrEmpty(item);
         }
         if (anything)
         {
             throw new Exception(Resources.Labels.InvalidSurvey);
         }
         else
         {
             return false;
         }
     }
     return true;
 }
 public PostPageViewModel()
 {
     _survey = new Survey() { Answers = new string[6] };
     _webService = HttpService.CreateInstance();
     SendMessageCommand = new SendMessageCommand(_webService);
     SendMessageCommand.CanExecuteChanged += (o, e) =>
     {
         IsProgressVisible = !SendMessageCommand.CanExecute(null);
         (Page.ApplicationBar.Buttons[SEND_INDEX] as ApplicationBarIconButton).IsEnabled = !IsProgressVisible;
     };
 }
        public async override Task<ContextResult<bool>> SendMessage(string subject, string message, Survey survey, string threadId = null)
        {
            EnsureLoggedIn();

            if (String.IsNullOrEmpty(Config.NickName) && String.IsNullOrEmpty(Config.FakeNickName))
            {
                throw new InvalidOperationException("User not even NickName set!");
            }
            string @params = JsonParamsCreator(PARAM_SUBJECT, subject,
                                               PARAM_MESSAGE, message,
                                               PARAM_SURVEY, (Survey)survey,
                                               PARAM_THREAD_ID, threadId);            
            string jsonResponse = await PostData(Config.BaseURL + POST, @params);
            return Parse<bool>(jsonResponse);
        }