mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-04 16:10:16 -04:00
34 lines
975 B
C#
34 lines
975 B
C#
![]() |
using System;
|
|||
|
using Windows.UI.Xaml;
|
|||
|
using Microsoft.Xaml.Interactivity;
|
|||
|
using ModernKeePass.Common;
|
|||
|
|
|||
|
namespace ModernKeePass.Actions
|
|||
|
{
|
|||
|
public class NavigateToUrlAction : DependencyObject, IAction
|
|||
|
{
|
|||
|
public string Url
|
|||
|
{
|
|||
|
get { return (string)GetValue(UrlProperty); }
|
|||
|
set { SetValue(UrlProperty, value); }
|
|||
|
}
|
|||
|
|
|||
|
public static readonly DependencyProperty UrlProperty =
|
|||
|
DependencyProperty.Register("Url", typeof(string), typeof(NavigateToUrlAction), new PropertyMetadata(string.Empty));
|
|||
|
|
|||
|
public object Execute(object sender, object parameter)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var uri = new Uri(Url);
|
|||
|
return Windows.System.Launcher.LaunchUriAsync(uri).GetAwaiter().GetResult();
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
MessageDialogHelper.ShowErrorDialog(ex);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|