forked from amkovkov/GranuSightSoftware2
feat: SystemView
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user