Exemple #1
0
        internal void UpdateLastMessage(bool updateRttMessage)
        {
            //****************************************************************************************
            // Update/Set last sent message.
            //*****************************************************************************************
            if ((this._messages != null) && (this._messages.Count != 0))
            {
                int offset = !updateRttMessage ? 1 : 2;
                this.LastMessage = this._messages[this._messages.Count - offset].Content;
                LastMessageTime  = this._messages[this._messages.Count - offset].MessageTime;

                if (this.LastMessageDate.Date != this._messages[this._messages.Count - offset].MessageTime.Date)
                {
                    this.LastMessageDate = this._messages[this._messages.Count - offset].MessageTime.Date;
                    // Add date separator here
                    var chatMsg = new VATRPChatMessage(MessageContentType.Info)
                    {
                        MessageTime         = new DateTime(this.LastMessageDate.Year, this.LastMessageDate.Month, this.LastMessageDate.Day),
                        IsSeparator         = true,
                        IsRTTMarker         = updateRttMessage,
                        IsIncompleteMessage = false
                    };

                    Tools.InsertByIndex(chatMsg, this.Messages, this._messages.Count - offset);
                }
                else
                {
                    this.LastMessageDate = this._messages[this._messages.Count - offset].MessageTime.Date;
                }
            }
        }
Exemple #2
0
 internal void DeleteMessage(VATRPChatMessage msg)
 {
     if (this.IsMessagesLoaded)
     {
         if (this.Messages == null)
         {
             return;
         }
         this.Messages.Remove(msg);
     }
     else if (this.TempMessages != null)
     {
         this.TempMessages.Remove(msg);
     }
 }
Exemple #3
0
        internal void AddMessage(VATRPChatMessage msg, bool isRtt)
        {
            //****************************************************************************************
            // Call Decline message or any other chat message, Add to Chat window.
            //*****************************************************************************************
            if (this.IsMessagesLoaded)
            {
                if (this.Messages == null)
                {
                    return;
                }

                if (!isRtt)
                {
                    //  Added 5/2/2017 MITRE-fjr
                    try
                    {
                        this.Messages.Add(msg);
                    }
                    catch (Exception ex)
                    {
                        Debug.Write(ex.Message);
                    }
                }
                else
                {
                    // RTT message should be inserted before RTT end marker
                    if (this.Messages.Count > 0)
                    {
                        if (Messages[Messages.Count - 1].IsRTTEndMarker)
                        {
                            Tools.InsertByIndex(msg, this.Messages, this._messages.Count - 2);
                        }
                        else
                        {
                            this.Messages.Add(msg);
                        }
                    }
                }
            }
            else if (this.TempMessages != null)
            {
                this.TempMessages.Add(msg);
            }
        }
Exemple #4
0
 internal bool CheckMessage(VATRPChatMessage other)
 {
     if (other == null)
     {
         return(false);
     }
     for (int i = 0; i < Messages.Count; i++)
     {
         var msg = Messages[i];
         if ((msg != null) &&
             (msg.MessageTime == other.MessageTime &&
              msg.Direction == other.Direction))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #5
0
        public void InsertRttWrapupMarkers(IntPtr callPtr)
        {
            var startRttMessage = new VATRPChatMessage(MessageContentType.Text)
            {
                IsRTTMarker         = false,
                IsRTTStartMarker    = true,
                IsIncompleteMessage = false,
                IsRTTMessage        = false,
                MessageTime         = DateTime.Now
            };

            Messages.Add(startRttMessage);

            var endRttMessage = new VATRPChatMessage(MessageContentType.Text)
            {
                IsRTTMarker         = false,
                IsRTTEndMarker      = true,
                IsIncompleteMessage = false,
                IsRTTMessage        = false,
                MessageTime         = DateTime.Now.AddHours(3)
            };

            Messages.Add(endRttMessage);
        }