public static void NotifyNewMessage(Message message) { Dialog d = dialogs.First(x => x.User.id == message.user_id); if (d.IsOpened) { if (d.IsFocused) { return; } else { Helpers.Flasher.FlashWindow(d.Window, 5); } } else { Notificator.ShowMessagePopup(message); } Notificator.PlaySound(Notificator.NotificationSound.Message); }
public static Message Message(Object[] array) { Message m = new Message(); m.id = Convert.ToInt32(array[1]); m.user_id = Convert.ToInt32(array[3]); m.Date = Convert.ToInt32(array[4]); m.Body = Convert.ToString(array[6]); int[] flags = Flags(Convert.ToInt32(array[2])); foreach (int flag in flags) { switch (flag) { case 1: m.Unread = true; break; case 2: m.Mine = true; break; case 8: //imprtant break; case 16: //chat break; case 34: //from friend break; case 64: //spam break; case 128: //deleted break; case 256: //not spam break; case 512: //has attachment break; } } return m; }
public static void NewMessage(Message message) { Message maybeExist = messages.Find(x => x.id == message.id); if (maybeExist == null) { if (message.Mine) { Message maybeSending = sending.Find(m => m.Body == message.Body);// устроить поиск по прикреплениям if (maybeSending != null) { maybeSending.id = message.id; return; } else { Message maybeError = errored.Find(m => m.Body == message.Body);// устроить поиск по прикреплениям if (maybeError != null) { maybeSending.id = message.id; return; } } } else { NotifyNewMessage(message); } messages.Add(message); var dialog = dialogs.First(d => d.User.id == message.user_id); dialog.NewMessage(message); UpDialog(dialog); } }
public async void SendMessage(string messageText) { Message m = new Message() { Mine = true, Body = messageText, Sending = true, read_state = 0, user_id = user.id, Date = Time.EpochNow }; Memory.messages.Add(m); messages.Add(m); ScrollDown(); OnPropertyChanged("Last"); Task<int> sendMessageTask = Api.Request.SendMessage(user.id, messageText); int mid = await sendMessageTask; if (mid != 0) { m.id = mid; m.Sending = false; } }
public void NewMessage(Message message) { StopTypping(); messages.Add(message); OnPropertyChanged("Last"); ScrollDown(); }
public static void ShowMessagePopup(Message message) { MessagePopup popup = new MessagePopup(message); Tray.ShowCustomBalloon(popup, PopupAnimation.Slide, null); }
public static void NewMessage(Message message) { PlaySound(NotificationSound.Message); }
public MessagePopup(Message message) { this.message = message; InitializeComponent(); TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing); closeTimer = new Timer(); closeTimer.Interval = 4000; closeTimer.Elapsed += closeTimerElapsed; Loaded += FancyBalloon_Loaded; }