public override void Execute(TabItem contextViewModel, object parameter) { if (parameter == null || !contextViewModel.HasImage) { return; } switch (parameter) { case "Open": { Helper.OpenWindow <AdonisWindow>(contextViewModel.Header + " (Image)", () => { var popout = new ImagePopout { Title = contextViewModel.Header + " (Image)", Width = contextViewModel.Image.Width, Height = contextViewModel.Image.Height, WindowState = contextViewModel.Image.Height > 1000 ? WindowState.Maximized : WindowState.Normal, ImageCtrl = { Source = contextViewModel.Image } }; RenderOptions.SetBitmapScalingMode(popout.ImageCtrl, BoolToRenderModeConverter.Instance.Convert(contextViewModel.RenderNearestNeighbor)); popout.Show(); }); break; } case "Copy": ClipboardExtensions.SetImage(contextViewModel.ImageBuffer, Path.ChangeExtension(contextViewModel.Header, ".png")); break; case "Save": contextViewModel.SaveImage(false); break; } }
private void OnCopyImage(object sender, RoutedEventArgs e) { ClipboardExtensions.SetImage(_imagebuffer, FILENAME); }