private void OnAddLink() { if (SelectedLink == null) { return; } if (MessageLinks == null) { MessageLinks = new ObservableCollection <Link>(); } if (MessageLinks.Where(l => l.ID == SelectedLink.ID).Count() != 0) { UIMessager.ShowMessage("Ссылка на данный объект уже прикреплена к сообщению"); return; } MessageLinks.Add(SelectedLink); OnPropertyChanged("MessageLinks"); }
// for resend function public NewMessageViewModel(WorkspaceViewModel requester, Window windowInstance, Message message, string param) : this(requester, windowInstance) { switch (param) { case "resend": NewMessage.MessageTitle = message.MessageTitle; NewMessage.MessageBody = message.MessageBody; if (MessageLinks == null) { MessageLinks = new ObservableCollection <Link>(); } foreach (var link in message.LinkList) { var item = Link.Pull(link.ID); MessageLinks.Add(item); } break; case "reply": if (MessageUserList == null) { MessageUserList = new ObservableCollection <User>(); } MessageUserList.Add(User.Pull(message.SenderID)); NewMessage.MessageTitle = "re: " + message.MessageTitle; NewMessage.MessageBody = "re: " + message.MessageTitle + "\n-------от " + message.LocalizedSendDate + "-------\n"; break; } RefreshView(); }