Ejemplo n.º 1
0
        /// <summary>
        /// Adds message to a message queue.
        /// </summary>
        /// <param name="msgViewModel">Message view model.</param>
        private void AddMessageToMessageQueue(MessageViewModel msgViewModel)
        {
            ParticipantViewModel newParticipant = null;

            lock (m_syncRoot)
            {
                if (msgViewModel != null)
                {
                    if (msgViewModel.MessageSource != null && !String.IsNullOrEmpty(msgViewModel.MessageSource.DisplayName))
                    {
                        if (!String.Equals(m_lastMessageSender, msgViewModel.MessageSource.DisplayName))
                        {
                            //Different display name. Store the new display name as last known display name.
                            m_lastMessageSender = msgViewModel.MessageSource.DisplayName;
                            newParticipant      = new ParticipantViewModel(msgViewModel.MessageSource);
                        }
                    }
                }
            }

            if (newParticipant != null)
            {
                //Add an empty line and then
                this.AddMessage(ConversationViewModel.EmptyMessageViewModel);
                //Add a seperate display name line.
                this.AddMessage(new MessageViewModel(newParticipant, string.Empty, MessageColor.White, DateTime.Now));
            }
            //Add message after stripping out the display name.
            msgViewModel.MessageSource.DisplayName = string.Empty;
            this.AddMessage(msgViewModel);
        }
Ejemplo n.º 2
0
 internal MessageViewModel(ParticipantViewModel participantViewModel, string displayMessage, MessageColor displayColor, DateTime time)
 {
     this.MessageSource  = participantViewModel;
     this.DisplayMessage = displayMessage;
     this.DisplayColor   = displayColor;
     this.Time           = time;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public ConversationViewModel(Dispatcher dispatcher, string endpointUri, string userName, string phoneNumber, string queueName, string productId)
        {
            m_localParticipant = new ParticipantViewModel(userName, phoneNumber, ConversationViewModel.LocalParticipantDisplayNameMessageColor);
            m_productId        = productId;

            this.Dispatcher = dispatcher;

            this.Initialize(queueName, endpointUri, productId, userName);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="copy">Copy.</param>
 internal ParticipantViewModel(ParticipantViewModel copy)
 {
     this.DisplayName      = copy.DisplayName;
     this.DisplayNameColor = copy.DisplayNameColor;
     this.PhoneNumber      = copy.PhoneNumber;
 }