/// <summary> /// Received new message by long poll /// </summary> /// <param name="message"></param> void WebRequestsBuilder_GetMessageReceived(LongPollServerData message) { if ((message.flag & (int)LongPollServerData.Flags.Unread) == (int)LongPollServerData.Flags.Unread) { var mesToChange = (from m in (MessagesListBox.ItemsSource as List<MessagesItemViewModel>) where m.Uid == message.from_id.ToString() select m).FirstOrDefault(); if (mesToChange != null) { mesToChange.Mid = message.message_id.ToString(); mesToChange.LastMessage = message.text; mesToChange.ReceivedTime = message.timestamp; if ((message.flag & (int)LongPollServerData.Flags.Unread) == (int)LongPollServerData.Flags.Unread) mesToChange.IsRead = Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush; else mesToChange.IsRead = Application.Current.Resources["PhoneSubtleBrush"] as SolidColorBrush; } ReceivedMessagesCounterStackPanel.Visibility = System.Windows.Visibility.Visible; if (ReceivedMessagesCounterTextBlock.Text == string.Empty) { ReceivedMessagesCounterTextBlock.Text = "0"; } ReceivedMessagesCounterTextBlock.Text = (int.Parse(ReceivedMessagesCounterTextBlock.Text) + 1).ToString(); } }
/// <summary> /// Received flags reset by long poll /// </summary> /// <param name="message"></param> void WebRequestsBuilder_GetFlagsResetReceived(LongPollServerData message) { //Sxala ashxatum yerpvor im uxarkac messagener@ dimacin@ karduma -1 a anum... if (message.flag == 1) { ReceivedMessagesCounterStackPanel.Visibility = System.Windows.Visibility.Visible; if (ReceivedMessagesCounterTextBlock.Text == string.Empty) { ReceivedMessagesCounterTextBlock.Text = "0"; } ReceivedMessagesCounterTextBlock.Text = (int.Parse(ReceivedMessagesCounterTextBlock.Text) - 1).ToString(); } if (ReceivedMessagesCounterTextBlock.Text == "0") { ReceivedMessagesCounterStackPanel.Visibility = System.Windows.Visibility.Collapsed; } //Guyn@ poxel ete kardacelem namak@ }