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
@@ -168,9 +168,7 @@ public partial class AnalyzerService
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
_logger.LogInformation("Подготовка данных"); _logger.LogInformation("Подготовка данных");
var trainDataSet = var trainDataSet = _calibrationContext.VectorRecords
_calibrationContext.VectorRecords
.Where(r => r.SampleRecord != null) .Where(r => r.SampleRecord != null)
.Where(r => brand == null || r.SampleRecord!.SampleBrand == brand) .Where(r => brand == null || r.SampleRecord!.SampleBrand == brand)
.Select(r => .Select(r =>
+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; using GSS2.UI.Core.ViewModels;
namespace GSS2.ViewModels.Common; 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);
}
} }
+79 -2
View File
@@ -6,8 +6,85 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:DataType="vm:SystemViewModel"> x:DataType="vm:SystemViewModel">
<Grid> <UserControl.Resources>
<TextBlock Text="Системная страница" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/> <SolidColorBrush x:Key="MenuBackground" Color="#00357a" />
<SolidColorBrush x:Key="MenuBorder" Color="#0865b2" />
<SolidColorBrush x:Key="Overlay" Color="#0865b23f" />
<SolidColorBrush x:Key="ButtonBackground" Color="#0865b2" />
<SolidColorBrush x:Key="ButtonDangerBackground" Color="#b20808" />
<SolidColorBrush x:Key="ButtonForeground" Color="#ffffff" />
<SolidColorBrush x:Key="MainBackground" Color="#001e46" />
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="Button">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
</Style>
<Style Selector="Button.danger">
<Setter Property="Background" Value="{StaticResource ButtonDangerBackground}" />
</Style>
<Style Selector="Button.vertical">
<Setter Property="MinWidth" Value="40" />
</Style>
<Style Selector="TextBox">
<Setter Property="FontSize" Value="20"/>
</Style>
<Style Selector="TextBox.singleline">
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>
<Style Selector="TextBox.multiline">
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="AcceptsReturn" Value="True" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
<Style Selector="TextBlock">
<Setter Property="FontSize" Value="20"/>
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<Style Selector="TextBlock.mini">
<Setter Property="FontSize" Value="16"/>
<Setter Property="Margin" Value="0,0,0,0" />
</Style>
</UserControl.Styles>
<Border Width="1080" Height="540">
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" ColumnSpacing="20" RowSpacing="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition Width="300"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Button Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" Command="{Binding CloseCommand}" >
<TextBlock Text="Закрыть ПО"/>
</Button>
<Button Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Command="{Binding RestartCommand}" >
<TextBlock Text="Перезагрузить ПО"/>
</Button>
<Button Grid.Row="1" Grid.Column="0" HorizontalAlignment="Stretch" Command="{Binding ShutdownCommand}" >
<TextBlock Text="Выключить прибор"/>
</Button>
<Button Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" Command="{Binding RebootCommand}" >
<TextBlock Text="Перезагрузить прибор"/>
</Button>
</Grid> </Grid>
</Border>
</UserControl> </UserControl>