private void ExecuteImageDropCommand(object[] parameters) { try { MMCenterImage image = (MMCenterImage)parameters[0]; string path = (string)parameters[1]; image.ImageSource = new BitmapImage(new Uri(path)); } catch (NotSupportedException) { MessageBox.Show("지원되지 않는 파일입니다.", "Memories", MessageBoxButton.OK, MessageBoxImage.Error); } }
private static UIElement BookUIToUIElement(BookUI source) { if (source.UIType == BookUIEnum.TextUI) { var richTextBox = (source as BookTextUI).ToRichTextBox();// datacontext가 book image ui 라서 command가 발생되지 않음 return(richTextBox); } else if (source.UIType == BookUIEnum.ImageUI) { MMCenterImage image = (source as BookImageUI).ToImage(); return(image); } else { throw new ArgumentOutOfRangeException(source + " is not BookUI"); } }
public static MMCenterImage ToImage(this BookImageUI bookImageUI, bool isLayout = false) { MMCenterImage image = new MMCenterImage(); BookUIToFE(bookImageUI, image); if (!isLayout) { image.SetBinding(MMCenterImage.ImageSourceProperty, new Binding("ImageSource") { Mode = BindingMode.TwoWay, Converter = new ByteArrayToImageSourceConverter(), TargetNullValue = new BitmapImage(new Uri("pack://application:,,,/Resources/Img/MemoriesEmptyImage.jpg")) }); } return(image); }
private void ExecuteImageSelectCommand(MMCenterImage image) { SelectImage(image); }