chore: modify open image logic.

This commit is contained in:
NaBian committed 2023-01-17 17:21:18 +08:00
1 parent 456390b775
commit 689d5e7a80
2 files changed
+7 -6

No files matched your search

@@ -166,6 +166,8 @@ public class ImageViewer : Control
private MouseBinding _mouseMoveBinding; private MouseBinding _mouseMoveBinding;
private ImageBrowser _imageBrowser;
#endregion Data #endregion Data
#region ctor #region ctor
@@ -588,13 +590,11 @@ public class ImageViewer : Control
private void ButtonWindowsOpen_OnClick(object sender, RoutedEventArgs e) private void ButtonWindowsOpen_OnClick(object sender, RoutedEventArgs e)
{ {
try if (Uri is { } uri)
{ {
Process.Start(ImgPath); _imageBrowser?.Close();
} _imageBrowser = new ImageBrowser(uri);
catch (Exception exception) _imageBrowser.Show();
{
MessageBox.Show(exception.Message);
} }
} }
@@ -43,6 +43,7 @@ public class ImageBrowser : Window
WindowStartupLocation = WindowStartupLocation.CenterScreen; WindowStartupLocation = WindowStartupLocation.CenterScreen;
WindowStyle = WindowStyle.None; WindowStyle = WindowStyle.None;
Topmost = true;
AllowsTransparency = true; AllowsTransparency = true;
} }