30 lines
899 B
C#
30 lines
899 B
C#
using System.Windows;
|
|
using System.Windows.Media.Imaging;
|
|
|
|
namespace AxCopilot.Views;
|
|
|
|
public partial class LauncherWindow
|
|
{
|
|
private bool TryOpenClipboardImagePreview()
|
|
{
|
|
if (_vm.SelectedItem?.Data is not Services.ClipboardEntry clipEntry || clipEntry.IsText)
|
|
return false;
|
|
|
|
var originalImage = Services.ClipboardHistoryService.LoadOriginalImage(clipEntry.OriginalImagePath);
|
|
BitmapSource? imageToPreview = originalImage ?? clipEntry.Image;
|
|
if (imageToPreview == null)
|
|
return false;
|
|
|
|
Hide();
|
|
|
|
var preview = new ClipboardImagePreviewWindow(imageToPreview, clipEntry.OriginalImagePath)
|
|
{
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen,
|
|
};
|
|
preview.Resources.MergedDictionaries.Add(Resources);
|
|
preview.Show();
|
|
preview.Activate();
|
|
return true;
|
|
}
|
|
}
|