/// <summary> /// Called on server response. /// </summary> protected void Handle_Vote_Response(string response, Handler_Type type) { if (response.Contains("500")) { Message.ShowMessage("Error interno del servidor."); return; } if (User.User_Info.Polls_Data.Exists(x => x.id == poll.Id)) { User.User_Info.Polls_Data.Find(x => x.id == poll.Id).response = temp_vote; } else { User.User_Info.Polls_Data.Add(new User.Vote_Data() { id = poll.Id, response = temp_vote }); } for (int x = 0; x < poll.Vote_Voters.Count; x++) { if (poll.Vote_Voters[x].Exists(a => a.Id == User.User_Info.Id)) { poll.Vote_Voters[x].Remove(poll.Vote_Voters[x].Find(a => a.Id == User.User_Info.Id)); } } poll.Vote_Voters[temp_vote].Add(User.User_Info); poll.Status = poll.Vote_Types[temp_vote]; poll.Selected_Option_Idx = temp_vote; List <Data_struct> polls = Polls.Data_List_Get(typeof(Polls)); for (int x = 0; x < polls.Count; x++) { if (polls[x].Id == poll.Id) { polls[x] = poll; Polls.Data_List_Set(typeof(Polls), polls); break; } } Message.ShowMessage("Base de datos actualizada con éxito."); if (this != null) { Show_Poll_Details(); Set_Interactable(true); } Database_Handler.Update_Unread(Handler_Type.polls); }