1.1.4 -> 0.0.1 第9次更新

This commit is contained in:
Space Time 2025-03-02 12:12:35 +08:00
parent fbe3e79626
commit bd2893affa
3 changed files with 33 additions and 17 deletions

View File

@ -14,6 +14,7 @@ internal partial class App : Application
public override void OnFrameworkInitializationCompleted() public override void OnFrameworkInitializationCompleted()
{ {
// Todo: Check x11-utils & xdg-utils environment for Linux.
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{ {
#region Upgrade Settings #region Upgrade Settings

View File

@ -49,21 +49,29 @@ public partial class AboutWin : Window
}); });
} }
private void AboutButton_Click(object sender, RoutedEventArgs e) private async Task AboutButton_ClickAsync(object sender, RoutedEventArgs e)
{ {
//Button senderButton = (Button)sender; Button senderButton = (Button)sender;
//if (senderButton == VersionButton) if (senderButton == VersionButton)
// await MessageBoxManager.GetMessageBoxStandard(string.Empty, $"{AboutConst._ReleasePagePasswordLabel} 3wnj").ShowWindowDialogAsync(this); await MessageBoxManager.GetMessageBoxStandard(string.Empty, $"{AboutConst._ReleasePagePasswordLabel} 3wnj").ShowWindowDialogAsync(this);
//ProcessStartInfo processStartInfo = new(senderButton == EmailButton ? "mailto:" : string.Empty + ToolTip.GetTip(senderButton)) { UseShellExecute = true }; string processStartUrl = senderButton == EmailButton ? "mailto:" : string.Empty + ToolTip.GetTip(senderButton);
//try { Process.Start(processStartInfo); } try
//catch (UnauthorizedAccessException) {
//{ if (OperatingSystem.IsWindows())
// processStartInfo.Verb = "RunAs"; Process.Start(new ProcessStartInfo(processStartUrl) { UseShellExecute = true });
// Process.Start(processStartInfo); else
//} Process.Start("xdg-open", processStartUrl);
}
catch (UnauthorizedAccessException)
{
if (OperatingSystem.IsWindows())
Process.Start(new ProcessStartInfo(processStartUrl) { UseShellExecute = true, Verb = "RunAs" });
else
Process.Start("sudo", $"xdg-open {processStartUrl}");
}
} }
private void AboutWin_KeyDown(object sender, KeyEventArgs e) private void AboutWin_KeyDown(object sender, KeyEventArgs e)

View File

@ -331,7 +331,10 @@ public partial class MainWin : Window
continue; continue;
if (await MessageBoxManager.GetMessageBoxStandard(string.Empty, MainConst._LaunchNginxErrorPrompt, ButtonEnum.YesNo).ShowWindowDialogAsync(this) == ButtonResult.Yes) if (await MessageBoxManager.GetMessageBoxStandard(string.Empty, MainConst._LaunchNginxErrorPrompt, ButtonEnum.YesNo).ShowWindowDialogAsync(this) == ButtonResult.Yes)
Process.Start(new ProcessStartInfo(MainConst.NginxErrorLogsPath) { UseShellExecute = true }); if (OperatingSystem.IsWindows())
Process.Start(new ProcessStartInfo(MainConst.NginxErrorLogsPath) { UseShellExecute = true });
else
Process.Start("xdg-open", MainConst.NginxErrorLogsPath);
break; break;
} }
@ -532,8 +535,8 @@ public partial class MainWin : Window
try { Process.Start(new ProcessStartInfo(cealHostPath) { UseShellExecute = true }); } try { Process.Start(new ProcessStartInfo(cealHostPath) { UseShellExecute = true }); }
catch (UnauthorizedAccessException) { Process.Start(new ProcessStartInfo(cealHostPath) { UseShellExecute = true, Verb = "RunAs" }); } catch (UnauthorizedAccessException) { Process.Start(new ProcessStartInfo(cealHostPath) { UseShellExecute = true, Verb = "RunAs" }); }
else else
try { Process.Start("vi", cealHostPath); } try { Process.Start("xdg-open", cealHostPath); }
catch (UnauthorizedAccessException) { Process.Start("sudo", $"vi {cealHostPath}"); } catch (UnauthorizedAccessException) { Process.Start("sudo", $"xdg-open {cealHostPath}"); }
} }
private async void EditConfButton_Click(object sender, RoutedEventArgs e) private async void EditConfButton_Click(object sender, RoutedEventArgs e)
{ {
@ -557,7 +560,7 @@ public partial class MainWin : Window
if (OperatingSystem.IsWindows()) if (OperatingSystem.IsWindows())
Process.Start(new ProcessStartInfo(confPath) { UseShellExecute = true }); Process.Start(new ProcessStartInfo(confPath) { UseShellExecute = true });
else else
Process.Start("vi", confPath); Process.Start("xdg-open", confPath);
} }
private async void UpdateUpstreamHostButton_Click(object? sender, RoutedEventArgs e) private async void UpdateUpstreamHostButton_Click(object? sender, RoutedEventArgs e)
{ {
@ -595,8 +598,12 @@ public partial class MainWin : Window
await MessageBoxManager.GetMessageBoxStandard(string.Empty, MainConst._UpdateUpstreamHostSuccessMsg).ShowWindowDialogAsync(this); await MessageBoxManager.GetMessageBoxStandard(string.Empty, MainConst._UpdateUpstreamHostSuccessMsg).ShowWindowDialogAsync(this);
} }
else if (overrideOptionResult == ButtonResult.No) else if (overrideOptionResult == ButtonResult.No)
try { Process.Start(new ProcessStartInfo(upstreamUpstreamHostUrl) { UseShellExecute = true }); } if (OperatingSystem.IsWindows())
catch (UnauthorizedAccessException) { Process.Start(new ProcessStartInfo(upstreamUpstreamHostUrl) { UseShellExecute = true, Verb = "RunAs" }); } try { Process.Start(new ProcessStartInfo(upstreamUpstreamHostUrl) { UseShellExecute = true }); }
catch (UnauthorizedAccessException) { Process.Start(new ProcessStartInfo(upstreamUpstreamHostUrl) { UseShellExecute = true, Verb = "RunAs" }); }
else
try { Process.Start("xdg-open", upstreamUpstreamHostUrl); }
catch (UnauthorizedAccessException) { Process.Start("sudo", $"xdg-open {upstreamUpstreamHostUrl}"); }
} }
} }
catch when (sender == null) { } catch when (sender == null) { }