private void PasteImageCommand_Execute(object obj) { string fileName = Guid.NewGuid().ToString() + ".png"; string fullPath = System.IO.Path.Combine(ApplicationViewModel.ClipboardImageShare, fileName); if (ClipboardHelper.SaveImageToFile(fullPath)) { txtMessage.GetBindingExpression(TextBox.TextProperty).UpdateSource(); if (ComputedMessage is WhiteboardChatMessage) { WhiteboardChatMessage message = new WhiteboardChatMessage { FromUser = ApplicationViewModel.Current.ChatProxy.CurrentUser, ImageUrl = fullPath, }; Message = message.ToMessageString(); _sentMessageID = ComputedMessage.ID; ApplicationViewModel.Current.ChatProxy.SendMessage(ComputedMessage); } else { ImageUrlChatMessage message = new ImageUrlChatMessage { FromUser = ApplicationViewModel.Current.ChatProxy.CurrentUser, ImageUrl = fullPath, ToUsers = ComputedMessage.ToUsers, }; message.Tags.Add(FixedFilterTag); ApplicationViewModel.Current.ChatProxy.SendMessage(message); } } }
private void ImageLoaded(object sender, RoutedEventArgs e) { ImageUrlChatMessage message = (sender as Image).DataContext as ImageUrlChatMessage; if (message != null) { message.Loaded = true; } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { InsertImageWindow window = sender as InsertImageWindow; if (window.Accepted) { ImageUrlChatMessage imageMessage = new ImageUrlChatMessage(); imageMessage.ImageUrl = window.SelectedResult.LargeImageUrl; Message = imageMessage.ToMessageString(); MoveCursorToEnd(); } }
private void Window_Closed(object sender, EventArgs e) { InsertImageWindow window = sender as InsertImageWindow; if (window.Accepted) { ImageUrlChatMessage imageMessage = new ImageUrlChatMessage(); imageMessage.ImageUrl = window.SelectedResult.LargeImageUrl; if (ApplicationViewModel.Current.ComputedMessage.ToUsers.Count > 0) { imageMessage.ToUsers.Clear(); imageMessage.ToUsers.AddRange(ApplicationViewModel.Current.ComputedMessage.ToUsers); } imageMessage.Tags = ApplicationViewModel.Current.ComputedMessage.Tags; ApplicationViewModel.Current.Message = imageMessage.ToMessageString(); MoveCursorToEnd(); } }
void ImageUrlChatMessageDataTemplate_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { Mouse.OverrideCursor = Cursors.Wait; ImageUrlChatMessage urlMessage = (sender as Image).DataContext as ImageUrlChatMessage; if (urlMessage != null) { Process.Start(urlMessage.ImageUrl); } } catch (Exception ex) { MedConfigMessageBox.ShowError(ex.Message); } finally { Mouse.OverrideCursor = null; } }