Skip to content

Commit

Permalink
Dont crash if copy from clipboard fails, closes #68
Browse files Browse the repository at this point in the history
  • Loading branch information
U-C-S committed Mar 20, 2024
1 parent 0ffa367 commit 69e2665
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Source/Hurl.BrowserSelector/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ async private void Window_KeyEvents(object sender, KeyEventArgs e)
break;
}
case Key.C:
Clipboard.SetText(UriGlobal.Value);
try
{
Clipboard.SetText(UriGlobal.Value);
}
catch (Exception err)
{
System.Windows.MessageBox.Show(err.Message);
}
break;
case Key.R:
MinimizeWindow();
Expand All @@ -107,7 +114,18 @@ async private void Window_KeyEvents(object sender, KeyEventArgs e)

}

private void LinkCopyBtnClick(object sender, RoutedEventArgs e) => Clipboard.SetText(UriGlobal.Value);
private void LinkCopyBtnClick(object sender, RoutedEventArgs e)
{
try
{
Clipboard.SetText(UriGlobal.Value);
}
catch (Exception err)
{
System.Windows.MessageBox.Show(err.Message);
}
}

private void SettingsBtnClick(object sender, RoutedEventArgs e) => Process.Start("explorer", "\"" + Constants.APP_SETTINGS_MAIN + "\"");
private void Draggable(object sender, MouseButtonEventArgs e) => this.DragMove();
private void CloseBtnClick(object sender, RoutedEventArgs e) => MinimizeWindow();
Expand Down

0 comments on commit 69e2665

Please sign in to comment.