コード例 #1
0
 public ConversationViewModel(FriendViewModel friendViewModel)
 {
     _friendViewModel = friendViewModel;
     MessageGroups = new ObservableCollection<MessageGroupViewModel>();
     ToxModel.Instance.FriendMessageReceived += FriendMessageReceivedHandler;
     ToxModel.Instance.FriendTypingChanged += FriendTypingChangedHandler;
 }
コード例 #2
0
 public ReceivedMessageViewModel(string text, DateTime timestamp, ToxMessageType messageType,
     FriendViewModel sender)
 {
     Text = text;
     Timestamp = timestamp;
     MessageType = messageType;
     Sender = sender;
     State = MessageDeliveryState.Delivered;
 }
コード例 #3
0
 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
ファイル: ChatPage.xaml.cs プロジェクト: SamTheDev/WinTox
        /// 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.");
            }
        }