Use api functions instead

This commit is contained in:
Jack251970 2025-05-21 11:59:24 +08:00
parent 5626ab71c7
commit 6e36b08cad

View file

@ -7,6 +7,7 @@ using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Documents; using System.Windows.Documents;
using System.Windows.Navigation;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using Flow.Launcher.Infrastructure.UserSettings; using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.ViewModel; using Flow.Launcher.ViewModel;
@ -33,6 +34,7 @@ namespace Flow.Launcher
public ObservableCollection<CustomExplorerViewModel> CustomExplorers { get; set; } public ObservableCollection<CustomExplorerViewModel> CustomExplorers { get; set; }
public CustomExplorerViewModel CustomExplorer => CustomExplorers[SelectedCustomExplorerIndex]; public CustomExplorerViewModel CustomExplorer => CustomExplorers[SelectedCustomExplorerIndex];
public SelectFileManagerWindow(Settings settings) public SelectFileManagerWindow(Settings settings)
{ {
_settings = settings; _settings = settings;
@ -46,13 +48,9 @@ namespace Flow.Launcher
Close(); Close();
} }
private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e) private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{ {
Process.Start(new ProcessStartInfo App.API.OpenUrl(e.Uri.AbsoluteUri);
{
FileName = e.Uri.AbsoluteUri,
UseShellExecute = true
});
e.Handled = true; e.Handled = true;
} }
@ -62,9 +60,9 @@ namespace Flow.Launcher
if (!IsFileManagerValid(CustomExplorer.Path)) if (!IsFileManagerValid(CustomExplorer.Path))
{ {
var result = App.API.ShowMsgBox( var result = App.API.ShowMsgBox(
string.Format((string)Application.Current.FindResource("fileManagerPathNotFound"), string.Format(App.API.GetTranslation("fileManagerPathNotFound"),
CustomExplorer.Name, CustomExplorer.Path), CustomExplorer.Name, CustomExplorer.Path),
(string)Application.Current.FindResource("fileManagerPathError"), App.API.GetTranslation("fileManagerPathError"),
MessageBoxButton.YesNo, MessageBoxButton.YesNo,
MessageBoxImage.Warning); MessageBoxImage.Warning);
@ -136,11 +134,7 @@ namespace Flow.Launcher
hyperlink.Inlines.Add(url); hyperlink.Inlines.Add(url);
hyperlink.RequestNavigate += (s, args) => hyperlink.RequestNavigate += (s, args) =>
{ {
Process.Start(new ProcessStartInfo App.API.OpenUrl(args.Uri.AbsoluteUri);
{
FileName = args.Uri.AbsoluteUri,
UseShellExecute = true
});
args.Handled = true; args.Handled = true;
}; };