public static MessageViewModel GetMessage(string UserId, int MessageId) { Message msg = MessageDB.GetMessage(UserId, MessageId); MessageViewModel msgView = new MessageViewModel(msg.ID, msg.sender.UserName, msg.sender.Id, msg.Title, msg.Text, msg.SendDate, msg.IsRead); return(msgView); }
public MessageInfo(MessageDB message, UserDB msgFrom) { this.Message = message; this.MessageUser = msgFrom; pStepTypesForStrip = new List<MessageStep.StepTypes> (); IsTextOnlyChecked = false; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); _noMessageTextView = FindViewById <TextView>(Resource.Id.emptyText); _recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); _recyclerView.ChildViewAdded += (sender, args) => { _noMessageTextView.Visibility = ViewStates.Gone; }; _recyclerView.ChildViewRemoved += (sender, args) => { if (_recyclerView.ChildCount == 0) { _noMessageTextView.Visibility = ViewStates.Visible; } }; _db = MessageDB.Create(); _messageViewerAdapter = new MessageViewerAdapter(_db.GetMessageDataSource()); _recyclerView.SetAdapter(_messageViewerAdapter); _recyclerView.SetLayoutManager(new LinearLayoutManager(this)); _handler = new Handler(x => { OnDataSourceUpdated(x); }); _dataSourceUpdateListener = new DataSourceUpdateListener(_handler); }
public MessageReceived(MessageDB message, Context c, bool readOnly = false) { MessageReceivedUtil.message = message; MessageReceivedUtil.context = c; MessageReceivedUtil.readOnly = readOnly; startActivity(c); }
public IHttpActionResult GetMessage(int id) { Message poruka = MessageDB.GetMessageById(id); if (poruka == null) { return(BadRequest()); } return(Ok(poruka)); }
public IHttpActionResult GetMessage(int id) { //FileLogger.Instance.Log("api/message/id HttpGet request", DataFormatUtil.GetFormatedLongDateTimeString(DateTime.Now)); Message poruka = MessageDB.GetMessageById(id); if (poruka == null) { return(NotFound()); } return(Ok(poruka)); }
public IHttpActionResult CreateMessageAsync([FromBody] Message message) { //FileLogger.Instance.Log("api/message HttpPost request", DataFormatUtil.GetFormatedLongDateTimeString(DateTime.Now)); Message result = MessageDB.CreateMessage(message); if ((result) == null) { return(BadRequest()); } return(Ok(result)); }
public IHttpActionResult DeleteMessage(int id) { //FileLogger.Instance.Log("api/message/id HttpDelete request", DataFormatUtil.GetFormatedLongDateTimeString(DateTime.Now)); bool result = MessageDB.DeleteUser(id); if (!result) { return(BadRequest()); } return(Ok()); }
public static List <MessageViewModel> GetAllMessages(string UserId) { var messagesToUser = MessageDB.GetAllMessages(UserId); List <MessageViewModel> messages = new List <MessageViewModel>(); foreach (Message msg in messagesToUser) { messages.Add(new MessageViewModel(msg.ID, msg.sender.UserName, msg.sender.Id, msg.Title, msg.Text, msg.SendDate, msg.IsRead)); } return(messages.OrderByDescending(m => m.SendDate).ToList()); }
public IEnumerable <Message> GetAllMessages() { //FileLogger.Instance.Log("api/message HttpGet request", DataFormatUtil.GetFormatedLongDateTimeString(DateTime.Now)); List <Message> lista = new List <Message>(); lista = MessageDB.GetAllMessages(); if (lista == null) { NotFound(); } return(lista); }
public JsonResult MakeMessagesSeen(int _messageId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; MessageDB.GetInstance().MakeMessagesSeen(_messageId, userId); return(Json("")); } catch (Exception exc) { throw exc; } }
public JsonResult SendMessage(int _lastMessageId, string _text, int _receiverId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var result = MessageDB.GetInstance().SendMessage(_lastMessageId, userId, _text, _receiverId); return(Json(result != null ? result.Id : 0)); } catch (Exception exc) { throw exc; } }
/// <summary> /// Отправка сообщения /// </summary> async void OnSendTapped(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(EditorMsg.Text)) { return; } string SendText = EditorMsg.Text; EditorMsg.Text = null; // Временное сообщение MessageThread msg = new MessageThread() { post_time = DateTime.Now, message_html = "Отправляем...", from = new From() { fname = "Bot Messenger", sname = "", login = "", profile_id = PlatformInvoke.profile_id } }; // Показываемм сообщение MessageDB.Add(msg); navigationDrawerList.ScrollTo(MessageDB[MessageDB.Count - 1], ScrollToPosition.MakeVisible, false); // Находим индекс сообщения int indexMSG = MessageDB.IndexOf(msg); // Запрос в API var sdk = new SDK.Threads(); var msgResponse = await sdk.Send(ThreadID, SendText); // Обновляем сообщение if (msgResponse != null) { MessageDB[indexMSG] = msgResponse; } else { MessageDB[indexMSG] = new MessageThread() { post_time = DateTime.Now, message_html = "Не удалось отправить сообщение :(<br />" + SendText, from = new From() { fname = "Bot Messenger => Ошибка запроса", sname = "", login = "******", profile_id = PlatformInvoke.profile_id } }; } }
public JsonResult GetMessagesBetweenTwoPeople(int _messageId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var list = _messageId == 0 ? new List <MessageRepo>() : MessageDB.GetInstance().GetMessagesBetweenTwoPeople(_messageId, userId); return(Json(list)); } catch (Exception exc) { throw exc; } }
public ActionResult Message(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonalMessage messageToView = MessageDB.GetMessageById(id); if (messageToView == null) { return(HttpNotFound()); } return(View(messageToView)); }
public JsonResult GetUnreadMessageCount() { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var count = MessageDB.GetInstance().GetUnreadMessageCount(userId); return(Json(count)); } catch (Exception exc) { throw exc; } }
public JsonResult GetNormalMessages() { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var list = MessageDB.GetInstance().GetMainMessageList(userId); return(Json(list)); } catch (Exception exc) { throw exc; } }
public MessageDB MapToMessageDB() { MessageDB msgDb = new MessageDB(); msgDb.Id = this.Id; if (this.Recipient != null) { msgDb.Recipient = this.Recipient.MapToRecipientDB(); } msgDb.SMSFilePath = this.SMSFilePath; msgDb.DateSent = this.DateSent; msgDb.FileName = this.FileName; return(msgDb); }
public override bool OnStartJob(JobParameters @params) { string json = @params.Extras.GetString("object"); if (!string.IsNullOrEmpty(json)) { List <SmsData> smsDataList = JsonConvert.DeserializeObject <List <SmsData> >(json); _internalTask = new PersistenceTask(this, @params, MessageDB.Create()); _internalTask.Execute(smsDataList.ToArray()); return(true); } return(false); }
//GET: Get inbox public ActionResult Messages(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ApplicationUser applicationUser = db.Users.Find(id); if (applicationUser == null) { return(HttpNotFound()); } InboxViewModel myModel = new InboxViewModel(); myModel.User = applicationUser; myModel.Messages = MessageDB.GetAllMessageForUserById(id); return(View(myModel)); }
public void Message_GetByListCompleted(object s, MessageGetByListCompletedEventArgs e) { LOLMessageClient client = (LOLMessageClient)s; client.MessageGetByListCompleted -= Message_GetByListCompleted; if (e.Error == null) { MessageDB msgDB = new MessageDB(); foreach (LOLMessageDelivery.Message message in e.Result) { msgDB = MessageDB.ConvertFromMessage(message); MessageConversations.initialMessages.Add(msgDB); } List<MessageDB> sortedList = new List<MessageDB>(); sortedList = MessageConversations.initialMessages.OrderBy(t => t.MessageSent).ToList(); MessageConversations.initialMessages = sortedList; dbm.InsertOrUpdateMessages(sortedList); List<Guid> users = new List<Guid>(); for (int i = 0; i < MessageConversations.initialMessages.Count; ++i) { foreach (MessageRecipientDB guid in MessageConversations.initialMessages[i].MessageRecipientDBList) { UserDB user = new UserDB(); user = dbm.GetUserWithAccountID(guid.AccountGuid); if (user == null && (guid.AccountGuid != AndroidData.CurrentUser.AccountID.ToString())) users.Add(new Guid(guid.AccountGuid)); } } if (users.Count == 0) { RunOnUiThread(delegate { if (progress != null) progress.Dismiss(); CreateUI(); }); } else { createIt = true; Contacts.AddUnknownUser auu = new Contacts.AddUnknownUser(users, context); //createNewUsers (users); } } }
public ActionResult Messages(InboxViewModel myModel) { PersonalMessage messageToSend = new PersonalMessage(); //checks sender info and adds it too the message if (User.Identity.GetUserId() != null) { PersonalMessageHelper.ProcessSender(myModel, messageToSend, User.Identity.GetUserId()); } //checks recipient info and adds it too the message if (myModel.RecipientName != null) { PersonalMessageHelper.ProcessRecipient(myModel, messageToSend); } ModelState.Clear(); TryValidateModel(myModel); //checks if the model is valid, and finishes building the message //stores it in the DB to be grabbed //reloads the inbox if (ModelState.IsValid) { PersonalMessageHelper.ProcessBody(myModel, messageToSend); MessageDB.AddMessage(messageToSend); myModel.Messages = MessageDB.GetAllMessageForUserById(myModel.User.Id); return(RedirectToAction("Messages", "Person", new { id = myModel.User.Id })); } //checks if user is null and displays a error page if (myModel.User == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //reloads the page return(View(myModel)); }
public static bool DeleteMessage(string userId, int messageId) { return(MessageDB.DeleteMessage(userId, messageId)); }
public static bool SendMessage(string senderId, string title, string text, List <String> receivers, List <int> groups) { return(MessageDB.SendMessage(senderId, title, text, receivers, groups)); }
private void SendAudioMessage() { ar.EndRecording(); MessageStepDB messageStep = new MessageStepDB(); messageStep.StepNumber = 1; messageStep.StepType = MessageStep.StepTypes.Voice; MessageDB message = new MessageDB(); message.FromAccountID = AndroidData.CurrentUser.AccountID; message.MessageStepDBList = new List<MessageStepDB>() { messageStep }; List<Guid> recipientGuids = new List<Guid>(); recipientGuids = Contacts.SelectContactsUtil.selectedContacts.Select(s => s.ContactAccountID).ToList(); ContentInfo contentInfo = new ContentInfo(MessageDB.ConvertFromMessageDB(message), recipientGuids); try { byte[] audioFile = File.ReadAllBytes(filename); contentInfo.VoiceRecordings.Add(messageStep.StepNumber, audioFile); #if DEBUG System.Diagnostics.Debug.WriteLine("audioFile.Length = {0}", audioFile.Length); #endif } catch (IOException e) { #if DEBUG System.Diagnostics.Debug.WriteLine("Exception thrown (audioFile read) : {0} - {1}", e.Message, e.StackTrace); #endif return; } #if DEBUG File.Delete(Android.OS.Environment.ExternalStorageDirectory + "/wz/audio.3gp"); File.Copy(path, Android.OS.Environment.ExternalStorageDirectory + "/wz/audio.3gp", true); #endif RunOnUiThread(delegate { mmg.QueueMessage(contentInfo, false, context); if (null != wowZapp.LaffOutOut.Singleton.OnGlobalReceived) wowZapp.LaffOutOut.Singleton.OnGlobalReceived(this, new MessageStepCreatedEventArgs(messageStep, null, path, null, null)); Finish(); }); }
private void random_Click(object s, EventArgs e) { ImageView senderObj = (ImageView)s; string conID = senderObj.ContentDescription; MessageDB message = new MessageDB(); message = dbm.GetMessage(conID); MessageReceived player = new MessageReceived(message, context); }
private void Message_GetConversationMessages(object s, MessageGetConversationMessageCompletedEventArgs e) { LOLMessageClient client = (LOLMessageClient)s; if (e.Error == null) { if (MessageConversations.currentConversationMessages.Count != 0) MessageConversations.currentConversationMessages.Clear(); LOLMessageConversation conversation = e.Result; List<Guid> notFound = new List<Guid>(); foreach (Guid guid in conversation.MessageIDs) { MessageDB message = new MessageDB(); message = dbm.GetMessage(guid.ToString()); if (message == null) notFound.Add(guid); else MessageConversations.currentConversationMessages.Add(message); } if (notFound.Count != 0) { client.MessageGetByListCompleted += MessageListComplete; client.MessageGetByListAsync(AndroidData.CurrentUser.AccountID, notFound, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); } else { UserDB user = new UserDB(); if (MessageConversations.currentConversationMessages [0].FromAccountGuid == AndroidData.CurrentUser.AccountID.ToString()) user = UserDB.ConvertFromUser(AndroidData.CurrentUser); else user = dbm.GetUserWithAccountID(MessageConversations.currentConversationMessages [0].FromAccountGuid); if (user != null) { MessageConversations.firstUserName = user.FirstName + " " + user.LastName; List<MessageDB> sortedList = new List<MessageDB>(); sortedList = MessageConversations.currentConversationMessages.OrderBy(t => t.MessageSent).ToList(); MessageConversations.currentConversationMessages = sortedList; if (sortedList.Count > 0) { LaffOutOut.Singleton.mmg.MessageSendConfirmCompleted -= MessageManager_MessageSendConfirm; Intent g = new Intent(this, typeof(MessageList)); StartActivity(g); } } } } #if DEBUG /*else System.Diagnostics.Debug.WriteLine ("Unable to get the conversation messages");*/ #endif }
private void MessageListComplete(object s, MessageGetByListCompletedEventArgs e) { LOLMessageClient client = (LOLMessageClient)s; client.MessageGetByListCompleted -= MessageListUpdatedComplete; if (e.Error == null) { foreach (LOLMessageDelivery.Message message in e.Result) { MessageDB me = new MessageDB(); me = MessageDB.ConvertFromMessage(message); MessageConversations.currentConversationMessages.Add(me); } dbm.InsertOrUpdateMessages(MessageConversations.currentConversationMessages); UserDB user = dbm.GetUserWithAccountID(MessageConversations.currentConversationMessages [0].FromAccountGuid); if (user == null && MessageConversations.currentConversationMessages [0].FromAccountGuid == AndroidData.CurrentUser.AccountID.ToString()) { user = UserDB.ConvertFromUser(AndroidData.CurrentUser); } else { if (MessageConversations.currentConversationMessages [0].MessageRecipientDBList.Count > 0) user = dbm.GetUserWithAccountID(MessageConversations.currentConversationMessages [0].MessageRecipientDBList [0].AccountGuid); } if (user != null) { MessageConversations.firstUserName = user.FirstName + " " + user.LastName; List<MessageDB> sortedList = new List<MessageDB>(); sortedList = MessageConversations.currentConversationMessages.OrderBy(t => t.MessageSent).ToList(); MessageConversations.currentConversationMessages = sortedList; if (sortedList.Count > 0) { LaffOutOut.Singleton.mmg.MessageSendConfirmCompleted -= MessageManager_MessageSendConfirm; Intent i = new Intent(this, typeof(MessageList)); StartActivity(i); } } } }
public PersistenceTask(JobService caller, JobParameters parameters, MessageDB db) { _caller = caller; _paramters = parameters; _db = db; }
private void SendTextMessage() { List<MessageStep> msgSteps = new List<MessageStep> (); MessageStepDB msgStep = new MessageStepDB (); msgStep.MessageText = text.Text; msgStep.StepNumber = 1; msgStep.StepType = MessageStep.StepTypes.Text; //msgSteps.Add (msgStep); List<Guid> toAccounts = new List<Guid> (); if (Contacts.SelectContactsUtil.selectedUserContacts == null) { foreach (ContactDB toAccount in Contacts.SelectContactsUtil.selectedContacts) { toAccounts.Add (toAccount.ContactUser.AccountID); } } else { foreach (UserDB toAccount in Contacts.SelectContactsUtil.selectedUserContacts) toAccounts.Add (toAccount.AccountID); Contacts.SelectContactsUtil.selectedUserContacts.Clear (); } MessageDB message = new MessageDB (); message.FromAccountID = AndroidData.CurrentUser.AccountID; message.MessageStepDBList = new List<MessageStepDB> (){msgStep}; ContentInfo contentInfo = new ContentInfo (MessageDB.ConvertFromMessageDB (message), toAccounts); mmg.QueueMessage (contentInfo, true, context); if (Messages.MessageReceivedUtil.FromMessages) Messages.MessageReceivedUtil.FromMessagesDone = true; Finish (); }
private string shortenBubble(MessageDB message) { string toReturn = ""; int n = -1; for (int t = 0; t < message.MessageStepDBList.Count; ++t) { #if DEBUG System.Diagnostics.Debug.WriteLine (message.MessageStepDBList [t].StepType); #endif if (message.MessageStepDBList [t].StepType == LOLMessageDelivery.MessageStep.StepTypes.Text) { n = t; continue; } } if (n != -1) { if (message.MessageStepDBList [n].MessageText.Length > 35) toReturn = message.MessageStepDBList [n].MessageText.Substring (0, 35) + "..."; else toReturn = message.MessageStepDBList [n].MessageText; } return toReturn; }
public static int SendMessage(Message msg, int oldId) { return(MessageDB.SendReplayToPCE(msg, oldId)); }
private void processMessages(MessageDB message) { List<MessageInfo> messageItems = new List<MessageInfo>(); MessageInfo msgInfo = new MessageInfo(message, message.FromAccountID == AndroidData.CurrentUser.AccountID ? UserDB.ConvertFromUser(AndroidData.CurrentUser) : dbm.GetUserWithAccountID(message.FromAccountGuid)); if (msgInfo != null) messageItems.Add(msgInfo); if (messageItems.Count > 0) { foreach (MessageInfo eachMessageInfo in messageItems) { this.MessageItems [eachMessageInfo.Message.MessageID] = eachMessageInfo; } }//end if }
private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver) { LinearLayout icons = new LinearLayout(context); icons.Orientation = Orientation.Horizontal; icons.SetGravity(GravityFlags.Left); icons.SetVerticalGravity(GravityFlags.CenterVertical); icons.SetMinimumHeight(30); icons.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0); if (message.MessageStepDBList.Count == 0) { ImageView random1 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, leftOver - (int)ImageHelper.convertDpToPixel(30f, context), 0); random1.LayoutParameters = lp; } random1.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(30f, context), (int)ImageHelper.convertDpToPixel(30f, context)); random1.SetBackgroundResource(Resource.Drawable.playblack); random1.ContentDescription = message.MessageGuid; random1.Click += delegate { Messages.MessageReceived m = new Messages.MessageReceived(message, context); }; RunOnUiThread(() => icons.AddView(random1)); } else { int end = message.MessageStepDBList.Count > 3 ? 3 : message.MessageStepDBList.Count; int iconSize = (int)ImageHelper.convertDpToPixel(34f, context); int toEnd = leftOver - (2 * iconSize) - (end * iconSize); for (int i = 0; i < end; ++i) { switch (message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: ImageView random2 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random2.LayoutParameters = lp; } random2.SetBackgroundResource(Resource.Drawable.textmsg); random2.ContentDescription = message.MessageID.ToString(); random2.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random2)); break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: ImageView random3 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random3.LayoutParameters = lp; } random3.SetBackgroundResource(Resource.Drawable.drawicon); random3.ContentDescription = message.MessageID.ToString(); random3.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random3)); break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: ImageView random4 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random4.LayoutParameters = lp; } random4.SetBackgroundResource(Resource.Drawable.comicon); random4.ContentDescription = message.MessageID.ToString(); random4.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random4)); break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: ImageView random5 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random5.LayoutParameters = lp; } random5.SetBackgroundResource(Resource.Drawable.comix); random5.ContentDescription = message.MessageID.ToString(); random5.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random5)); break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: ImageView random6 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random6.LayoutParameters = lp; } random6.SetBackgroundResource(Resource.Drawable.emoticon); random6.ContentDescription = message.MessageID.ToString(); random6.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random6)); break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: ImageView random7 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random7.LayoutParameters = lp; } random7.SetBackgroundResource(Resource.Drawable.polls); random7.ContentDescription = message.MessageID.ToString(); random7.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random7)); break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: ImageView random8 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random8.LayoutParameters = lp; } random8.SetBackgroundResource(Resource.Drawable.audiofile); random8.ContentDescription = message.MessageID.ToString(); random8.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random8)); break; case LOLMessageDelivery.MessageStep.StepTypes.Video: ImageView random9 = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random9.LayoutParameters = lp; } random9.SetBackgroundResource(Resource.Drawable.camera); random9.ContentDescription = message.MessageID.ToString(); random9.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(random9)); break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: ImageView randomA = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); randomA.LayoutParameters = lp; } randomA.SetBackgroundResource(Resource.Drawable.microphone); randomA.ContentDescription = message.MessageID.ToString(); randomA.Click += new EventHandler(imgMessage_Click); RunOnUiThread(() => icons.AddView(randomA)); break; } } ImageView randomp = new ImageView(context); using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(toEnd, 0, 0, 0); randomp.LayoutParameters = lp; } randomp.SetBackgroundResource(Resource.Drawable.playblack); randomp.ContentDescription = message.MessageID.ToString(); randomp.Click += new EventHandler(random_Click); RunOnUiThread(() => icons.AddView(randomp)); } RunOnUiThread(() => mBar.AddView(icons)); return mBar; }
private LinearLayout createMessageBar(LinearLayout mBar, MessageDB message, int leftOver) { RunOnUiThread(delegate { LinearLayout icons = new LinearLayout(context); ImageView random = null; icons.Orientation = Orientation.Horizontal; icons.SetGravity(GravityFlags.Left); icons.SetVerticalGravity(GravityFlags.CenterVertical); icons.SetMinimumHeight(30); int topPos = 0; if (wowZapp.LaffOutOut.Singleton.resizeFonts) topPos = 0; icons.SetPadding((int)ImageHelper.convertDpToPixel(10f, context), 0, (int)ImageHelper.convertDpToPixel(10f, context), 0); if (message.MessageStepDBList.Count == 0) { using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, leftOver - (int)ImageHelper.convertDpToPixel(30f, context), 0); random.LayoutParameters = lp; } random.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(30f, context), (int)ImageHelper.convertDpToPixel(30f, context)); random.SetBackgroundResource(Resource.Drawable.playblack); random.ContentDescription = message.MessageGuid; random.Click += delegate { Messages.MessageReceived m = new Messages.MessageReceived(message, context); }; icons.AddView(random); } } else { int end = message.MessageStepDBList.Count > 3 ? 3 : message.MessageStepDBList.Count; int iconSize = (int)ImageHelper.convertDpToPixel(34f, context); int toEnd = leftOver - (2 * iconSize) - (end * iconSize); for (int i = 0; i < end; ++i) { switch (message.MessageStepDBList [i].StepType) { case LOLMessageDelivery.MessageStep.StepTypes.Text: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.textmsg); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Animation: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.drawicon); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comicon: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.comicon); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Comix: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.comix); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Emoticon: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.emoticon); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Polling: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.polls); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.SoundFX: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.audiofile); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Video: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.camera); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; case LOLMessageDelivery.MessageStep.StepTypes.Voice: using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(0, 0, (int)ImageHelper.convertDpToPixel(1f, context), 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.microphone); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(imgMessage_Click); icons.AddView(random); } break; } } using (random = new ImageView (context)) { using (LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context))) { lp.SetMargins(toEnd, 0, 0, 0); random.LayoutParameters = lp; } random.SetBackgroundResource(Resource.Drawable.playblack); random.ContentDescription = message.MessageID.ToString(); random.Click += new EventHandler(random_Click); icons.AddView(random); } } mBar.AddView(icons); }); return mBar; }
private void btnPlay_Click(object s, EventArgs e) { if (readOnly == true) { MessageReceived player = new MessageReceived(ComposeMessageMainUtil.messageDB, context, true); return; } int i = 0; MessageDB tmpMessage = new MessageDB(); tmpMessage.FromAccountID = AndroidData.CurrentUser.AccountID; tmpMessage.MessageStepDBList = new List<MessageStepDB>(); tmpMessage.MessageRecipientDBList = new List<MessageRecipientDB>(); for (i = 0; i < ComposeMessageMainUtil.msgSteps.Count; ++i) { tmpMessage.MessageStepDBList.Add(MessageStepDB.ConvertFromMessageStep(ComposeMessageMainUtil.msgSteps [i])); tmpMessage.MessageStepDBList [i].ContentPackItemID = ComposeMessageMainUtil.contentPackID [i]; } for (i = 0; i < Contacts.SelectContactsUtil.selectedContacts.Count; ++i) { tmpMessage.MessageRecipientDBList.Add(new MessageRecipientDB()); tmpMessage.MessageRecipientDBList [i].AccountGuid = Contacts.SelectContactsUtil.selectedContacts [i].ContactGuid; } MessageReceived play = new MessageReceived(tmpMessage, context); return; }
private void PlayMessage(MessageDB message) { voiceFiles.Clear(); contentPackItems.Clear(); pollSteps.Clear(); MessageInfo messageInfo = this.MessageItems [message.MessageID]; ContentState dlState = new ContentState(message); contentPackItems = getLocalContentPackItems(dlState.ContentPackIDQ.ToList()) .ToDictionary(s => s.ContentPackItemID, s => ContentPackItemDB.ConvertFromContentPackItemDB(s)); if (messageInfo.HasContentInfo) { RunOnUiThread(delegate { if (progress != null) progress.Dismiss(); this.PlayUnsentMessage(messageInfo.ContentInfo); }); } else { Dictionary<Guid, Dictionary<int, string>> localVoiceFiles = getLocalVoiceFiles(new List<Pair<Guid, List<int>>>() { new Pair<Guid, List<int>>(dlState.Message.MessageID, dlState.VoiceIDQ.ToList()) }); if (!localVoiceFiles.TryGetValue(dlState.Message.MessageID, out voiceFiles)) voiceFiles = new Dictionary<int, string>(); pollSteps = getLocalPollingStepsForMessage(dlState.Message.MessageGuid) .ToDictionary(s => s.StepNumber, s => PollingStepDB.ConvertFromPollingStepDB(s)); List<int> animationStepNumbers = dlState.Message.MessageStepDBList .Where(s => s.StepType == MessageStep.StepTypes.Animation) .Select(s => s.StepNumber) .ToList(); dlState.RemoveExistingItems(contentPackItems.Keys.ToList(), voiceFiles.Keys.ToList(), pollSteps.Keys.ToList(), animationItems.Keys.ToList()); if (dlState.HasContentForDownload) { #if DEBUG System.Diagnostics.Debug.WriteLine("dlState has content for download"); #endif if (dlState.HasContentPackItems) { #if DEBUG System.Diagnostics.Debug.WriteLine("dlState has contentpackitems for download"); #endif LOLConnectClient service = new LOLConnectClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.ContentPackGetItemCompleted += Service_ContentPackGetItemCompleted; service.ContentPackGetItemAsync(dlState.ContentPackIDQ.Peek(), ContentPackItem.ItemSize.Small, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken), dlState); } else if (dlState.HasVoiceRecordings) { #if DEBUG System.Diagnostics.Debug.WriteLine("dlState has voicerecordings for download"); #endif LOLMessageClient service = new LOLMessageClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); service.MessageGetStepDataCompleted += Service_MessageGetStepData; service.MessageGetStepDataAsync(dlState.Message.MessageID, dlState.VoiceIDQ.Peek(), AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken), dlState); } else if (dlState.HasPollingSteps) { RunOnUiThread(delegate { #if DEBUG System.Diagnostics.Debug.WriteLine("dlState has pollingsteps for download"); #endif LOLMessageClient service = new LOLMessageClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); service.PollingStepGetCompleted += Service_PollingStepGetCompleted; service.PollingStepGetAsync(dlState.Message.MessageID, dlState.PollingIDQ.Peek(), AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken), dlState); }); } else if (dlState.HasAnimationSteps) { LOLMessageClient msgService = new LOLMessageClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); msgService.AnimationStepGetCompleted += Service_AnimationStepGetCompleted; msgService.AnimationStepGetAsync(dlState.Message.MessageID, dlState.AnimationIDQ.Peek(), AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken), dlState); } } else RunOnUiThread(delegate { StartPlayMessage(message); }); } }
public static List <Message> GetReplyForMe(int oldID) { return(MessageDB.GetResponseMessage(oldID)); }
private void messageBar_Click(object s, EventArgs e) { LinearLayout senderObj = (LinearLayout)s; string conID = senderObj.ContentDescription; MessageDB message = new MessageDB(); message = dbm.GetMessage(conID); MessageReceived player = new MessageReceived(message, context); }
private void generateMessageBarAndAnimate(string message, MessageDB msgList, UserDB contact, bool shutUp = false) { //RunOnUiThread (delegate { bool rpong = false; if (shutUp != true) { AudioPlayer ap = new AudioPlayer (context); Android.Content.Res.AssetManager am = this.Assets; ap.playFromAssets (am, "incoming.mp3"); } Guid grabGuid = Guid.Empty; RunOnUiThread (() => messageBar.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context))); int leftOver = Convert.ToInt32 (wowZapp.LaffOutOut.Singleton.ScreenXWidth - (picSize + 40)); LinearLayout.LayoutParams layParams; if (contact == null) throw new Exception ("Contact is null in generateMessageBarAndAnimate"); ImageView profilePic = new ImageView (context); using (layParams = new LinearLayout.LayoutParams (picSize, picSize)) { layParams.SetMargins ((int)ImageHelper.convertDpToPixel (15f, context), (int)ImageHelper.convertDpToPixel (20f, context), 0, 0); profilePic.LayoutParameters = layParams; } profilePic.SetBackgroundResource (Resource.Drawable.defaultuserimage); profilePic.Tag = new Java.Lang.String ("profilepic_" + contact.AccountID); RunOnUiThread (() => messageBar.AddView (profilePic)); if (Contacts.ContactsUtil.contactFilenames.Contains (contact.AccountGuid)) { rpong = true; using (Bitmap bm = BitmapFactory.DecodeFile (System.IO.Path.Combine (wowZapp.LaffOutOut.Singleton.ImageDirectory, contact.AccountGuid))) { using (MemoryStream ms = new MemoryStream ()) { bm.Compress (Bitmap.CompressFormat.Jpeg, 80, ms); byte[] image = ms.ToArray (); displayImage (image, profilePic); } } } else { if (contact.Picture.Length == 0) grabGuid = contact.AccountID; else { if (contact.Picture.Length > 0) loadProfilePicture (contact, profilePic); } } LinearLayout fromTVH = new LinearLayout (context); fromTVH.Orientation = Orientation.Vertical; fromTVH.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent); float textNameSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? (int)ImageHelper.convertPixelToDp (((25 * picSize) / 100), context) : 16f; TextView textFrom = new TextView (context); using (layParams = new LinearLayout.LayoutParams (leftOver, (int)textNameSize)) { layParams.SetMargins ((int)ImageHelper.convertDpToPixel (9.3f, context), (int)ImageHelper.convertPixelToDp (textNameSize - 1, context), 0, 0); textFrom.LayoutParameters = layParams; } float fontSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((12 * picSize) / 100), context) : ImageHelper.convertPixelToDp (14f, context); textFrom.SetTextSize (Android.Util.ComplexUnitType.Dip, fontSize); textFrom.SetTextColor (Color.Black); if (contact != null) textFrom.Text = contact.FirstName + " " + contact.LastName; else textFrom.Text = "Ann Onymouse"; RunOnUiThread (() => fromTVH.AddView (textFrom)); float textMessageSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((70 * picSize) / 100), context) : ImageHelper.convertDpToPixel (39f, context); TextView textMessage = new TextView (context); using (layParams = new LinearLayout.LayoutParams (leftOver, (int)textMessageSize)) { layParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10, context), 0); textMessage.LayoutParameters = layParams; } float fontSize2 = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((12 * picSize) / 100), context) : ImageHelper.convertPixelToDp (16f, context); textMessage.SetTextSize (Android.Util.ComplexUnitType.Dip, fontSize2); textMessage.SetTextColor (Color.White); textMessage.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0); if (!string.IsNullOrEmpty (message)) textMessage.SetBackgroundResource (Resource.Drawable.bubblesolidleft); textMessage.Text = message != string.Empty ? message : ""; textMessage.ContentDescription = msgList.MessageGuid; textMessage.Click += new EventHandler (textMessage_Click); RunOnUiThread (() => fromTVH.AddView (textMessage)); //} if (msgList != null) { LinearLayout messageItems = new LinearLayout (context); messageItems.Orientation = Orientation.Horizontal; float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((35 * picSize) / 100), context) : ImageHelper.convertDpToPixel (40f, context); using (layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) { layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context)); messageItems.LayoutParameters = layParams; } messageItems.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0); messageItems.SetGravity (GravityFlags.Left); messageItems = createMessageBar (messageItems, msgList, leftOver); RunOnUiThread (() => fromTVH.AddView (messageItems)); } RunOnUiThread (() => messageBar.AddView (fromTVH)); RunOnUiThread (delegate { hsv.RemoveAllViews (); hsv.AddView (messageBar); }); if (grabGuid != null) { LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint); service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted; service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, grabGuid, new Guid (AndroidData.ServiceAuthToken)); } //}); RunOnUiThread (delegate { Handler handler = new Handler (); handler.PostDelayed (new Action (() => { hsv.SmoothScrollTo (newX, 0); }), 2000); }); }
private void Message_ConversationsListComplete(object s, MessageGetConversationListCompletedEventArgs e) { LOLMessageClient client = (LOLMessageClient)s; client.MessageGetConversationListCompleted -= Message_ConversationsListComplete; if (e.Error == null) { if (MessageConversations.conversationsList.Count > 0) MessageConversations.conversationsList.Clear(); MessageConversations.conversationsList = e.Result; AndroidData.LastConvChecked = DateTime.Now; if (MessageConversations.initialMessages == null) MessageConversations.initialMessages = new List<MessageDB>(); else MessageConversations.initialMessages.Clear(); List<Guid> messagesToGet = new List<Guid>(); for (int i = 0; i < MessageConversations.conversationsList.Count; ++i) { MessageDB message = new MessageDB(); message = dbm.GetMessage(MessageConversations.conversationsList [i].MessageIDs [0].ToString()); if (message == null) { messagesToGet.Add(MessageConversations.conversationsList [i].MessageIDs [0]); #if DEBUG System.Diagnostics.Debug.WriteLine("MessageID (being sucked) = {0}", MessageConversations.conversationsList [i].MessageIDs [0]); #endif } else { MessageConversations.initialMessages.Add(message); #if DEBUG System.Diagnostics.Debug.WriteLine("MessageID (already stored) = {0}", message.MessageGuid); #endif } } if (messagesToGet.Count != 0) { client.MessageGetByListCompleted += Message_GetByListCompleted; client.MessageGetByListAsync(AndroidData.CurrentUser.AccountID, messagesToGet, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken)); } else { List<Guid> users = new List<Guid>(); for (int i = 0; i < MessageConversations.initialMessages.Count; ++i) { foreach (MessageRecipientDB guid in MessageConversations.initialMessages[i].MessageRecipientDBList) { UserDB user = new UserDB(); user = dbm.GetUserWithAccountID(guid.AccountGuid); if (user == null && (guid.AccountGuid != AndroidData.CurrentUser.AccountID.ToString())) users.Add(new Guid(guid.AccountGuid)); } } if (users.Count == 0) { RunOnUiThread(delegate { if (progress != null) progress.Dismiss(); CreateUI(); }); } else { createIt = true; Contacts.AddUnknownUser auu = new Contacts.AddUnknownUser(users, context); } } } else { int threadCount = waitThreadCount; for (int i = 0; i < threadCount; i++) { signal.Set(); }//end for isRefreshing = false; RunOnUiThread(() => GeneralUtils.Alert(context, Application.Context.GetString(Resource.String.errorConversationGrabTitle), Application.Context.GetString(Resource.String.errorConversationGrabMessage))); } }
private void SendContentPackMessage() { MessageStepDB messageStep = new MessageStepDB(); messageStep.StepNumber = 1; switch (option) { case 1: messageStep.StepType = MessageStep.StepTypes.Comix; break; case 2: messageStep.StepType = MessageStep.StepTypes.Comicon; break; case 5: messageStep.StepType = MessageStep.StepTypes.SoundFX; break; case 6: messageStep.StepType = MessageStep.StepTypes.Emoticon; break; case 7: messageStep.StepType = MessageStep.StepTypes.Animation; break; } if (option != 7) messageStep.ContentPackItemID = ContentPackItemsUtil.contentPackItemID; //else // messageStep.AnimationData = Animations.AnimationUtil.animation; MessageDB message = new MessageDB(); message.FromAccountID = AndroidData.CurrentUser.AccountID; message.MessageStepDBList = new List<MessageStepDB>() { messageStep }; List<Guid> recipientGuids = new List<Guid>(); recipientGuids = Contacts.SelectContactsUtil.selectedContacts.Select(s => s.ContactAccountID).ToList(); ContentInfo contentInfo = new ContentInfo(MessageDB.ConvertFromMessageDB(message), recipientGuids); //RunOnUiThread (delegate { mmg.QueueMessage(contentInfo, false, context); if (null != wowZapp.LaffOutOut.Singleton.OnGlobalReceived) wowZapp.LaffOutOut.Singleton.OnGlobalReceived(this, new MessageStepCreatedEventArgs(messageStep, null, null, null, null)); if (MessageReceivedUtil.FromMessages) MessageReceivedUtil.FromMessagesDone = true; Finish(); //}); }
private void playOut(string message) { MessageDB mess = new MessageDB(); mess = dbm.GetMessage(message); Messages.ComposeMessageMainUtil.messageDB = mess; Intent i = new Intent(this, typeof(Messages.ComposeMessageMainActivity)); i.PutExtra("readonly", true); StartActivity(i); }
private void StartPlayMessage(MessageDB message) { bool hasRespondedPollSteps = this.pollSteps.Count(s => s.Value.HasResponded) > 0; if (hasRespondedPollSteps) { RunOnUiThread(() => Toast.MakeText(context, Resource.String.pollGettingResults, ToastLength.Short).Show()); LOLMessageClient service = new LOLMessageClient(LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint); service.PollingStepGetResultsListCompleted += Service_PollingStepGetResultsListCompleted; service.PollingStepGetResultsListAsync(message.MessageID, AndroidData.CurrentUser.AccountID, new Guid(AndroidData.ServiceAuthToken), message); } else { #if DEBUG System.Diagnostics.Debug.WriteLine("about to play the message"); #endif RunOnUiThread(delegate { if (progress != null) RunOnUiThread(() => progress.Dismiss()); List<UserDB> recipients = new List<UserDB>(); UserDB tmpUsr = null; for (int m = 0; m < message.MessageRecipientDBList.Count; ++m) { tmpUsr = dbm.GetUserWithAccountID(message.MessageRecipientDBList [m].AccountGuid); if (tmpUsr != null) recipients.Add(tmpUsr); } tmpUsr = dbm.GetUserWithAccountID(message.FromAccountGuid); if (tmpUsr != null) recipients.Add(tmpUsr); MessagePlaybackController playbackController = new MessagePlaybackController(message.MessageStepDBList, this.contentPackItems, this.voiceFiles, this.pollSteps, new Dictionary<int, LOLMessageSurveyResult>(), markAsRead, recipients, context); #if DEBUG System.Diagnostics.Debug.WriteLine("we outa here"); #endif }); }//end if else }
public static bool CancelMessageResponse(int msgID) { return(MessageDB.GetCancelResponse(msgID)); }
private TextView messageTextBox(TextView txtMessage, MessageDB message, int position, int leftOver) { if (position < message.MessageStepDBList.Count) { if (string.IsNullOrEmpty(message.MessageStepDBList [position].MessageText)) txtMessage.Text = ""; else txtMessage.Text = message.MessageStepDBList [position].MessageText; } int nolines = (int)(ImageHelper.convertDpToPixel((txtMessage.Text.Length / 27f) * 12f, context)); txtMessage.SetHeight(nolines); txtMessage.SetTextColor(Android.Graphics.Color.Black); return txtMessage; }
public static int SendMessageToInterpreter(Message toSend) { return(MessageDB.SendMessageToInterpreter(toSend)); }
public static void CancelMessage(int id) { MessageDB.CancelMessage(id); }
public static List <Message> GetMessages(int userID) { return(MessageDB.GetMessages(userID)); }
private void Service_MessageMarkReadCompleted(object sender, MessageMarkReadCompletedEventArgs e) { LOLMessageClient service = (LOLMessageClient)sender; if (null == e.Error) { if (e.Result.ErrorNumber == "0" || string.IsNullOrEmpty(e.Result.ErrorNumber)) { Guid messageID = (Guid)e.UserState; #if(DEBUG) System.Diagnostics.Debug.WriteLine("Marked message as read!"); #endif dbm.MarkMessageRead(messageID.ToString(), AndroidData.CurrentUser.AccountID.ToString()); current++; if (current < markAsRead) { service.MessageMarkReadAsync(message [current].MessageID, AndroidData.CurrentUser.AccountID, AndroidData.NewDeviceID, new Guid(AndroidData.ServiceAuthToken), message [current].MessageID); } else { service.MessageMarkReadCompleted -= Service_MessageMarkReadCompleted; if (unknownContacts.Count != 0) { getNewContacts(unknownContacts); } else if (message [0].MessageRecipientDBList != null) { MessageDB mess = new MessageDB(); mess = messageItem.Message; generateMessageBarAndAnimate(shortenBubble(mess), message [0], messageItem.MessageUser); } } }//end if } else { #if(DEBUG) System.Diagnostics.Debug.WriteLine("Exception in message mark as read! {0}--{1}", e.Error.Message, e.Error.StackTrace); #endif }//end if else }