diff --git a/GSS2.Core/Analysis/AmineContent/AnalyzerService.cs b/GSS2.Core/Analysis/AmineContent/AnalyzerService.cs index 5f926c5..ce47b5e 100644 --- a/GSS2.Core/Analysis/AmineContent/AnalyzerService.cs +++ b/GSS2.Core/Analysis/AmineContent/AnalyzerService.cs @@ -168,9 +168,7 @@ public partial class AnalyzerService cancellationToken.ThrowIfCancellationRequested(); _logger.LogInformation("Подготовка данных"); - var trainDataSet = - - _calibrationContext.VectorRecords + var trainDataSet = _calibrationContext.VectorRecords .Where(r => r.SampleRecord != null) .Where(r => brand == null || r.SampleRecord!.SampleBrand == brand) .Select(r => diff --git a/GSS2/ViewModels/Common/SystemViewModel.cs b/GSS2/ViewModels/Common/SystemViewModel.cs index f5787a8..b3c915b 100644 --- a/GSS2/ViewModels/Common/SystemViewModel.cs +++ b/GSS2/ViewModels/Common/SystemViewModel.cs @@ -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); + } } diff --git a/GSS2/Views/Common/SystemView.axaml b/GSS2/Views/Common/SystemView.axaml index 2627143..01e6729 100644 --- a/GSS2/Views/Common/SystemView.axaml +++ b/GSS2/Views/Common/SystemView.axaml @@ -6,8 +6,85 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" x:DataType="vm:SystemViewModel"> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +