mirror of
https://github.com/BlossomiShymae/Needlework.Net.git
synced 2026-06-22 05:42:32 +02:00
fix: exception when opening latest update
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using Needlework.Net.Extensions;
|
||||||
using Needlework.Net.Models;
|
using Needlework.Net.Models;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|
||||||
namespace Needlework.Net.ViewModels.MainWindow
|
namespace Needlework.Net.ViewModels.MainWindow
|
||||||
{
|
{
|
||||||
public partial class NotificationViewModel : ObservableObject
|
public partial class NotificationViewModel : ObservableObject, IEnableLogger
|
||||||
{
|
{
|
||||||
public NotificationViewModel(Notification notification)
|
public NotificationViewModel(Notification notification)
|
||||||
{
|
{
|
||||||
@@ -20,8 +21,17 @@ namespace Needlework.Net.ViewModels.MainWindow
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public void OpenUrl()
|
public void OpenUrl()
|
||||||
{
|
{
|
||||||
var process = new Process() { StartInfo = new() { UseShellExecute = true } };
|
try
|
||||||
process.Start();
|
{
|
||||||
|
var url = Notification?.Url ?? "https://github.com/BlossomiShymae/Needlework.Net/releases/latest";
|
||||||
|
var process = new Process() { StartInfo = new(url) { UseShellExecute = true } };
|
||||||
|
process.Start();
|
||||||
|
}
|
||||||
|
catch (System.Exception exception)
|
||||||
|
{
|
||||||
|
this.Log()
|
||||||
|
.Error("Failed to open URL for notification: {@exception}", exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user