Пример #1
0
 public ConversationViewModel(FriendViewModel friendViewModel)
 {
     _friendViewModel = friendViewModel;
     MessageGroups = new ObservableCollection<MessageGroupViewModel>();
     ToxModel.Instance.FriendMessageReceived += FriendMessageReceivedHandler;
     ToxModel.Instance.FriendTypingChanged += FriendTypingChangedHandler;
 }
 public ReceivedMessageViewModel(string text, DateTime timestamp, ToxMessageType messageType,
     FriendViewModel sender)
 {
     Text = text;
     Timestamp = timestamp;
     MessageType = messageType;
     Sender = sender;
     State = MessageDeliveryState.Delivered;
 }
 protected void TryRemovePreviousMessageFromFriend(FriendViewModel friendToSearchFor)
 {
     foreach (var message in RecentMessages)
     {
         var actFriend = (FriendViewModel) message.Sender;
         if (actFriend.FriendNumber == friendToSearchFor.FriendNumber)
         {
             RecentMessages.Remove(message);
             return;
         }
     }
 }
Пример #4
0
        public SentMessageViewModel(string text, DateTime timestamp, ToxMessageType messageType, int id,
            FriendViewModel target)
        {
            Text = text;
            Timestamp = timestamp;
            MessageType = messageType;
            Sender = new UserViewModel();
            State = MessageDeliveryState.Pending;
            Id = id;
            _target = target;

            ToxModel.Instance.ReadReceiptReceived += ReadReceiptReceivedHandler;
            ToxModel.Instance.FriendConnectionStatusChanged += FriendConnectionStatusChangedHandler;

            SetupAndStartResendTimer();
        }
Пример #5
0
        /// The methods provided in this section are simply used to allow
        /// NavigationHelper to respond to the page's navigation methods.
        /// 
        /// Page specific logic should be placed in event handlers for the
        /// <see cref="Common.NavigationHelper.LoadState" />
        /// and
        /// <see cref="Common.NavigationHelper.SaveState" />
        /// .
        /// The navigation parameter is available in the LoadState method
        /// in addition to page state preserved during an earlier session.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            NavigationHelper.OnNavigatedTo(e);

            var friendViewModel = e.Parameter as FriendViewModel;
            if (friendViewModel != null)
            {
                DataContext = _friendViewModel = friendViewModel;
                SetupView();
            }
            else
            {
                throw new ArgumentException(
                    "Navigated to ChatPage with wrong type of parameter or with null! An object with the type of FriendViewModel is expected.");
            }
        }