Skip to content

Commit

Permalink
chore: modify open image logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
NaBian committed Jan 17, 2023
1 parent 456390b commit 689d5e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Shared/HandyControl_Shared/Controls/Image/ImageViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ public class ImageViewer : Control

private MouseBinding _mouseMoveBinding;

private ImageBrowser _imageBrowser;

#endregion Data

#region ctor
Expand Down Expand Up @@ -588,13 +590,11 @@ private void ButtonSave_OnClick(object sender, RoutedEventArgs e)

private void ButtonWindowsOpen_OnClick(object sender, RoutedEventArgs e)
{
try
{
Process.Start(ImgPath);
}
catch (Exception exception)
if (Uri is { } uri)
{
MessageBox.Show(exception.Message);
_imageBrowser?.Close();
_imageBrowser = new ImageBrowser(uri);
_imageBrowser.Show();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public ImageBrowser()

WindowStartupLocation = WindowStartupLocation.CenterScreen;
WindowStyle = WindowStyle.None;
Topmost = true;
AllowsTransparency = true;
}

Expand Down

0 comments on commit 689d5e7

Please sign in to comment.