feat: SystemView

This commit is contained in:
2026-05-13 15:47:31 +03:00
parent 3cc4d21947
commit 2d99880d08
3 changed files with 124 additions and 6 deletions
+43
View File
@@ -1,3 +1,11 @@
using System.Diagnostics;
using System.Reflection;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Avalonia.Threading;
using GSS2.UI.Core.ViewModels;
namespace GSS2.ViewModels.Common;
@@ -8,4 +16,39 @@ public partial class SystemViewModel : ViewModelBase
{
}
[RelayCommand]
void Close()
{
Dispatcher.UIThread.InvokeShutdown();
}
[RelayCommand]
void Shutdown()
{
var process = new Process();
process.StartInfo.FileName = "/usr/bin/sudo";
process.StartInfo.Arguments = "/sbin/shutdown -h now";
process.Start();
}
[RelayCommand]
void Reboot()
{
var process = new Process();
process.StartInfo.FileName = "/usr/bin/sudo";
process.StartInfo.Arguments = "/sbin/shutdown -r now";
process.Start();
}
[RelayCommand]
void Restart()
{
var process = new Process();
process.StartInfo.FileName = "/home/granusight/.dotnet/dotnet";
process.StartInfo.Arguments = Assembly.GetExecutingAssembly().Location;
Dispatcher.UIThread.InvokeShutdown();
process.Start();
Environment.Exit(0);
}
}