public void ReadVer_Latest(BinaryReader reader) { try { int count = reader.ReadInt32(); _msisdn = Encoding.UTF8.GetString(reader.ReadBytes(count), 0, count); if (_msisdn == "*@N@*") { _msisdn = null; } count = reader.ReadInt32(); _contactName = Encoding.UTF8.GetString(reader.ReadBytes(count), 0, count); if (_contactName == "*@N@*") // this is done so that we can specifically set null if contact name is not there { _contactName = null; } count = reader.ReadInt32(); _lastMessage = Encoding.UTF8.GetString(reader.ReadBytes(count), 0, count); if (_lastMessage == "*@N@*") { _lastMessage = null; } _timeStamp = reader.ReadInt64(); _isOnhike = reader.ReadBoolean(); _messageStatus = (ConvMessage.State)reader.ReadInt32(); _isFirstMsg = reader.ReadBoolean(); _lastMsgId = reader.ReadInt64(); _muteVal = reader.ReadInt32(); } catch { throw new Exception("Conversation Object corrupt"); } }
public MyChatBubble(ConvMessage cm) { this.Text = cm.Message; this.TimeStamp = TimeUtils.getTimeStringForChatThread(cm.Timestamp); this._messageId = cm.MessageId; this._timeStampLong = cm.Timestamp; this._messageState = cm.MessageStatus; this._metaDataString = cm.MetaDataString; if (cm.FileAttachment != null) { this.FileAttachment = cm.FileAttachment; setAttachmentState(cm.FileAttachment.FileState); } else if (!cm.HasAttachment) { var currentPage = ((App)Application.Current).RootFrame.Content as NewChatThread; if (currentPage != null) { ContextMenu contextMenu = null; if (String.IsNullOrEmpty(cm.MetaDataString) || !cm.MetaDataString.Contains("poke")) { contextMenu = currentPage.createAttachmentContextMenu(Attachment.AttachmentState.COMPLETED, false, true); //since it is not an attachment message this bool won't make difference } else { contextMenu = currentPage.createAttachmentContextMenu(Attachment.AttachmentState.CANCELED, true, true); //set to tru to have only delete option for nudge bubbles } ContextMenuService.SetContextMenu(this, contextMenu); } } }
public ConversationListObject(string msisdn, string contactName, string lastMessage, bool isOnhike, long timestamp, byte[] avatar, ConvMessage.State msgStatus, long lastMsgId) { this._msisdn = msisdn; this._contactName = contactName; this._lastMessage = lastMessage; this._timeStamp = timestamp; this._isOnhike = isOnhike; this._avatar = avatar; this._messageStatus = msgStatus; this._lastMsgId = lastMsgId; }
public void SetSentMessageStatus(ConvMessage.State msgState) { if ((int)messageState <= (int)msgState) { messageState = msgState; Deployment.Current.Dispatcher.BeginInvoke(() => { switch (messageState) { case ConvMessage.State.SENT_CONFIRMED: setSDRImage(UI_Utils.Instance.Sent); if (this.FileAttachment != null && this.FileAttachment.FileState != Attachment.AttachmentState.COMPLETED) { this.setAttachmentState(Attachment.AttachmentState.COMPLETED); } break; case ConvMessage.State.SENT_DELIVERED: setSDRImage(UI_Utils.Instance.Delivered); break; case ConvMessage.State.SENT_DELIVERED_READ: setSDRImage(UI_Utils.Instance.Read); break; case ConvMessage.State.SENT_FAILED: setSDRImage(UI_Utils.Instance.HttpFailed); break; case ConvMessage.State.SENT_UNCONFIRMED: if (this.FileAttachment != null) { if (string.IsNullOrEmpty(this.FileAttachment.FileKey)) { this.SDRImage.Source = UI_Utils.Instance.HttpFailed; } else { this.SDRImage.Source = UI_Utils.Instance.Trying; } } else { scheduleTryingImage(); } break; } }); } }
public void ReadVer_1_0_0_0(BinaryReader reader) { _msisdn = reader.ReadString(); _contactName = reader.ReadString(); if (_contactName == "*@N@*") // this is done so that we can specifically set null if contact name is not there { _contactName = null; } _lastMessage = reader.ReadString(); _timeStamp = reader.ReadInt64(); _isOnhike = reader.ReadBoolean(); _messageStatus = (ConvMessage.State)reader.ReadInt32(); _isFirstMsg = reader.ReadBoolean(); _lastMsgId = reader.ReadInt64(); }
public ConversationListObject(string msisdn, string contactName, string lastMessage, long timestamp, ConvMessage.State msgStatus, long lastMsgId) : this(msisdn, contactName, lastMessage, false, timestamp, null, msgStatus, lastMsgId) { }
public ConversationBox(BitmapImage avatarImage, string userName, string lastMessage, long timestamp, ConvMessage.State messageState, string msisdn) { InitializeComponent(); this.AvatarImage = avatarImage; this.UserName = userName; this.LastMessage = lastMessage; this.Timestamp = timestamp; this.MessageState = messageState; this.Msisdn = msisdn; }