refactor: format axamls

This commit is contained in:
2026-02-19 08:58:46 +03:00
parent 41e34e05e8
commit 14832e14c5
9 changed files with 289 additions and 172 deletions
+10 -6
View File
@@ -1,12 +1,16 @@
<Application xmlns="https://github.com/avaloniaui" <Application
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.Test.App"
xmlns:local="using:GSS2.Test" xmlns="https://github.com/avaloniaui"
x:Class="GSS2.Test.App" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
RequestedThemeVariant="Dark"> xmlns:local="using:GSS2.Test"
RequestedThemeVariant="Dark">
<Application.Styles> <Application.Styles>
<FluentTheme /> <FluentTheme />
</Application.Styles> </Application.Styles>
<Application.DataTemplates> <Application.DataTemplates>
<local:DependencyInjectionViewLocator/> <local:DependencyInjectionViewLocator />
</Application.DataTemplates> </Application.DataTemplates>
</Application> </Application>
+12 -9
View File
@@ -1,10 +1,13 @@
<Window xmlns="https://github.com/avaloniaui" <Window
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.Test.MainWindow"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns="https://github.com/avaloniaui"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:GSS2.Test.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
x:DataType="vm:MainWindowViewModel" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="GSS2.Test.MainWindow" xmlns:vm="using:GSS2.Test.ViewModels"
Title="{Binding Title}"> Title="{Binding Title}"
<ContentControl Content="{Binding MainViewModel}"/> x:DataType="vm:MainWindowViewModel">
<ContentControl Content="{Binding MainViewModel}" />
</Window> </Window>
+90 -20
View File
@@ -1,30 +1,100 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.Test.Views.MainView"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns="https://github.com/avaloniaui"
xmlns:local_vm="using:GSS2.Test.ViewModels" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core_vm="using:GSS2.UI.Core.ViewModels" xmlns:core="using:GSS2.UI.Core"
xmlns:core="using:GSS2.UI.Core" xmlns:core_vm="using:GSS2.UI.Core.ViewModels"
x:DataType="local_vm:MainViewModel" xmlns:local_vm="using:GSS2.Test.ViewModels"
x:Class="GSS2.Test.Views.MainView"> xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:DataType="local_vm:MainViewModel">
<Grid ColumnDefinitions="*,100" RowDefinitions="*,*"> <Grid ColumnDefinitions="*,100" RowDefinitions="*,*">
<Button Grid.Row="0" Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsEnabled="{Binding CanScrollBackward}" Command="{Binding ButtonUpClick}"/>
<Button Grid.Row="1" Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsEnabled="{Binding CanScrollForward}" Command="{Binding ButtonDownClick}"/> <core:SectionPanel
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="0"
CanScrollBackward="{Binding CanScrollBackward}"
CanScrollForward="{Binding CanScrollForward}"
ClipToBounds="True"
CurrentIndex="{Binding CurrentIndex}">
<core:SectionPanel Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" ClipToBounds="True" CanScrollForward="{Binding CanScrollForward}" CanScrollBackward="{Binding CanScrollBackward}" CurrentIndex="{Binding CurrentIndex}">
<Grid ColumnDefinitions="300,*"> <Grid ColumnDefinitions="300,*">
<ContentControl Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding IlluminatorControllerViewModel}" />
<ContentControl Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding CameraViewModel}" /> <ContentControl
Grid.Column="0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{Binding IlluminatorControllerViewModel}" />
<ContentControl
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{Binding CameraViewModel}" />
</Grid> </Grid>
<Grid ColumnDefinitions="100,*"> <Grid ColumnDefinitions="100,*">
<Button Grid.Column="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Command="{Binding ButtonCaptureClick}"/>
<Grid Grid.Column="1" ColumnDefinitions="*,*" RowDefinitions="*,*" > <Button
<core:OpenCvImage Grid.Column="0" Grid.Row="0" Image="{Binding Image1}" /> Grid.Column="0"
<core:OpenCvImage Grid.Column="1" Grid.Row="0" Image="{Binding Image2}" /> HorizontalAlignment="Stretch"
<core:OpenCvImage Grid.Column="0" Grid.Row="1" Image="{Binding Image3}" /> VerticalAlignment="Stretch"
<core:OpenCvImage Grid.Column="1" Grid.Row="1" Image="{Binding Image4}" /> Command="{Binding ButtonCaptureClick}" />
<Grid
Grid.Column="1"
ColumnDefinitions="*,*"
RowDefinitions="*,*">
<core:OpenCvImage
Grid.Row="0"
Grid.Column="0"
Image="{Binding Image1}" />
<core:OpenCvImage
Grid.Row="0"
Grid.Column="1"
Image="{Binding Image2}" />
<core:OpenCvImage
Grid.Row="1"
Grid.Column="0"
Image="{Binding Image3}" />
<core:OpenCvImage
Grid.Row="1"
Grid.Column="1"
Image="{Binding Image4}" />
</Grid> </Grid>
</Grid> </Grid>
<ContentControl VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Content="{Binding ResourcesViewModel}" />
<ContentControl
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Content="{Binding ResourcesViewModel}" />
</core:SectionPanel> </core:SectionPanel>
<Button
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Command="{Binding ButtonUpClick}"
IsEnabled="{Binding CanScrollBackward}" />
<Button
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Command="{Binding ButtonDownClick}"
IsEnabled="{Binding CanScrollForward}" />
</Grid> </Grid>
</UserControl> </UserControl>
+13 -13
View File
@@ -1,13 +1,13 @@
<Control xmlns="https://github.com/avaloniaui" <Control
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.UI.Core.Views.CameraView"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns="https://github.com/avaloniaui"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:GSS2.UI.Core.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
x:DataType="vm:CameraViewModel" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="GSS2.UI.Core.Views.CameraView" xmlns:vm="using:GSS2.UI.Core.ViewModels"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Background="{Binding Background}" x:DataType="vm:CameraViewModel"
StretchMode="{Binding StretchMode}" Background="{Binding Background}"
TileMode="{Binding TileMode}"> StretchMode="{Binding StretchMode}"
</Control> TileMode="{Binding TileMode}" />
@@ -1,80 +1,89 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.UI.Core.Views.IlluminatorControllerView"
xmlns:layout="using:Avalonia.Layout" xmlns="https://github.com/avaloniaui"
xmlns:local="using:GSS2.UI.Core.Views" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:GSS2.UI.Core.ViewModels" xmlns:behaviors="using:GSS2.UI.Core.Behaviors"
xmlns:behaviors="using:GSS2.UI.Core.Behaviors" xmlns:converters="using:GSS2.UI.Core.Converters"
xmlns:converters="using:GSS2.UI.Core.Converters" xmlns:layout="using:Avalonia.Layout"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia" xmlns:local="using:GSS2.UI.Core.Views"
x:Class="GSS2.UI.Core.Views.IlluminatorControllerView" xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
x:DataType="vm:IlluminatorControllerViewModel"> xmlns:vm="using:GSS2.UI.Core.ViewModels"
<Grid> x:DataType="vm:IlluminatorControllerViewModel">
<Grid x:Name="HorizontalLayout" IsVisible="{Binding Orientation, Converter={x:Static converters:OrientationToBoolConverter.IsHorizontal}}">
<Grid.RowDefinitions> <UserControl.Styles>
<RowDefinition Height="*" /> <Style Selector="Slider.horizontal">
<RowDefinition Height="Auto" /> <Setter Property="VerticalAlignment" Value="Stretch" />
</Grid.RowDefinitions> <Setter Property="Maximum" Value="1" />
<StackPanel Orientation="Horizontal" <Setter Property="Minimum" Value="0" />
HorizontalAlignment="Center" <Setter Property="Orientation" Value="Vertical" />
Spacing="20"> </Style>
<Slider Orientation="Vertical" <Style Selector="Slider.vertical">
Minimum="0" Maximum="1" <Setter Property="HorizontalAlignment" Value="Stretch" />
Value="{Binding WhiteIntencity}" <Setter Property="Maximum" Value="1" />
VerticalAlignment="Stretch"/> <Setter Property="Minimum" Value="0" />
<Slider Orientation="Vertical" <Setter Property="Orientation" Value="Horizontal" />
Minimum="0" Maximum="1" </Style>
Value="{Binding Uv365Intencity}" </UserControl.Styles>
VerticalAlignment="Stretch"/>
<Slider Orientation="Vertical" <Grid>
Minimum="0" Maximum="1"
Value="{Binding Uv254Intencity}" <Grid IsVisible="{Binding Orientation, Converter={x:Static converters:OrientationToBoolConverter.IsHorizontal}}">
VerticalAlignment="Stretch"/>
</StackPanel> <Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<StackPanel
HorizontalAlignment="Center"
Orientation="Horizontal"
Spacing="20">
<Slider Classes="horizontal" Value="{Binding WhiteIntencity}" />
<Slider Classes="horizontal" Value="{Binding Uv365Intencity}" />
<Slider Classes="horizontal" Value="{Binding Uv254Intencity}" />
</StackPanel>
<ToggleButton
Grid.Row="1"
Margin="0,10,0,0"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Content="Включить"
IsChecked="{Binding Enabled}" />
</Grid>
<Grid IsVisible="{Binding Orientation, Converter={x:Static converters:OrientationToBoolConverter.IsVertical}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Column="0"
VerticalAlignment="Center"
Orientation="Vertical"
Spacing="20">
<Slider Classes="vertical" Value="{Binding WhiteIntencity}" />
<Slider Classes="vertical" Value="{Binding Uv365Intencity}" />
<Slider Classes="vertical" Value="{Binding Uv254Intencity}" />
</StackPanel>
<ToggleButton
Grid.Column="1"
Margin="0,0,10,0"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Center"
Content="Включить"
IsChecked="{Binding Enabled}" />
</Grid>
<ToggleButton Grid.Row="1"
Content="Включить"
IsChecked="{Binding Enabled}"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Center"
Margin="0,10,0,0"/>
</Grid> </Grid>
<Grid x:Name="VerticalLayout" IsVisible="{Binding Orientation, Converter={x:Static converters:OrientationToBoolConverter.IsVertical}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"
Orientation="Vertical"
VerticalAlignment="Center"
Spacing="20">
<Slider Orientation="Horizontal"
Minimum="0" Maximum="1"
Value="{Binding WhiteIntencity}"
HorizontalAlignment="Stretch"/>
<Slider Orientation="Horizontal"
Minimum="0" Maximum="1"
Value="{Binding Uv365Intencity}"
HorizontalAlignment="Stretch"/>
<Slider Orientation="Horizontal"
Minimum="0" Maximum="1"
Value="{Binding Uv254Intencity}"
HorizontalAlignment="Stretch"/>
</StackPanel>
<ToggleButton Grid.Column="1"
Content="Включить"
IsChecked="{Binding Enabled}"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Center"
Margin="0,0,10,0"/>
</Grid>
</Grid>
</UserControl> </UserControl>
+9 -9
View File
@@ -1,9 +1,9 @@
<lvc:PieChart xmlns="https://github.com/avaloniaui" <lvc:PieChart
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.UI.Core.Views.ResourceBarView"
xmlns:vm="using:GSS2.UI.Core.ViewModels" xmlns="https://github.com/avaloniaui"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="GSS2.UI.Core.Views.ResourceBarView" xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
x:DataType="vm:ResourceBarViewModel" xmlns:vm="using:GSS2.UI.Core.ViewModels"
Series="{Binding Series}" x:DataType="vm:ResourceBarViewModel"
Bounds="{Binding Bounds, Mode=OneWayToSource}"> Bounds="{Binding Bounds, Mode=OneWayToSource}"
</lvc:PieChart> Series="{Binding Series}" />
+13 -13
View File
@@ -1,13 +1,13 @@
<lvc:CartesianChart xmlns="https://github.com/avaloniaui" <lvc:CartesianChart
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.UI.Core.Views.ResourceChartView"
xmlns:vm="using:GSS2.UI.Core.ViewModels" xmlns="https://github.com/avaloniaui"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="GSS2.UI.Core.Views.ResourceChartView" xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
x:DataType="vm:ResourceChartViewModel" xmlns:vm="using:GSS2.UI.Core.ViewModels"
Series="{Binding Series}" x:DataType="vm:ResourceChartViewModel"
YAxes="{Binding YAxes}" Bounds="{Binding Bounds, Mode=OneWayToSource}"
XAxes="{Binding XAxes}" EasingFunction="{x:Null}"
ZoomMode="None" Series="{Binding Series}"
EasingFunction="{x:Null}" XAxes="{Binding XAxes}"
Bounds="{Binding Bounds, Mode=OneWayToSource}"> YAxes="{Binding YAxes}"
</lvc:CartesianChart> ZoomMode="None" />
@@ -1,27 +1,53 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.UI.Core.Views.ResourceCpuUsageBarsView"
xmlns:local="using:GSS2.UI.Core.Views" xmlns="https://github.com/avaloniaui"
xmlns:vm="using:GSS2.UI.Core.ViewModels" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:GSS2.UI.Core.Behaviors" xmlns:behaviors="using:GSS2.UI.Core.Behaviors"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia" xmlns:local="using:GSS2.UI.Core.Views"
x:Class="GSS2.UI.Core.Views.ResourceCpuUsageBarsView" xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
x:DataType="vm:ResourceCpuUsageBarsViewModel" xmlns:vm="using:GSS2.UI.Core.ViewModels"
Bounds="{Binding Bounds, Mode=OneWayToSource}"> x:DataType="vm:ResourceCpuUsageBarsViewModel"
Bounds="{Binding Bounds, Mode=OneWayToSource}">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/> <ColumnDefinition Width="2*" />
<ColumnDefinition Width="*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsCoresColumnVisible}" /> <ColumnDefinition Width="*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsCoresColumnVisible}" />
<ColumnDefinition Width="*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsCoresColumnVisible}" /> <ColumnDefinition Width="*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsCoresColumnVisible}" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<local:ResourceBarView Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" DataContext="{Binding Cpu}" />
<local:ResourceBarView Grid.Row="0" Grid.Column="1" DataContext="{Binding Cpu0}" /> <local:ResourceBarView
<local:ResourceBarView Grid.Row="0" Grid.Column="2" DataContext="{Binding Cpu1}" /> Grid.Row="0"
<local:ResourceBarView Grid.Row="1" Grid.Column="1" DataContext="{Binding Cpu2}" /> Grid.RowSpan="2"
<local:ResourceBarView Grid.Row="1" Grid.Column="2" DataContext="{Binding Cpu3}" /> Grid.Column="0"
DataContext="{Binding Cpu}" />
<local:ResourceBarView
Grid.Row="0"
Grid.Column="1"
DataContext="{Binding Cpu0}" />
<local:ResourceBarView
Grid.Row="0"
Grid.Column="2"
DataContext="{Binding Cpu1}" />
<local:ResourceBarView
Grid.Row="1"
Grid.Column="1"
DataContext="{Binding Cpu2}" />
<local:ResourceBarView
Grid.Row="1"
Grid.Column="2"
DataContext="{Binding Cpu3}" />
</Grid> </Grid>
</UserControl> </UserControl>
+21 -16
View File
@@ -1,28 +1,33 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="GSS2.UI.Core.Views.ResourcesView"
xmlns:local="using:GSS2.UI.Core.Views" xmlns="https://github.com/avaloniaui"
xmlns:vm="using:GSS2.UI.Core.ViewModels" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:GSS2.UI.Core.Behaviors" xmlns:behaviors="using:GSS2.UI.Core.Behaviors"
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia" xmlns:local="using:GSS2.UI.Core.Views"
x:Class="GSS2.UI.Core.Views.ResourcesView" xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
x:DataType="vm:ResourcesViewModel" xmlns:vm="using:GSS2.UI.Core.ViewModels"
Bounds="{Binding Bounds, Mode=OneWayToSource}"> x:DataType="vm:ResourcesViewModel"
<Grid> Bounds="{Binding Bounds, Mode=OneWayToSource}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsChartsColumnVisible}" />
<ColumnDefinition Width="*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsBarsColumnVisible}" />
</Grid.ColumnDefinitions>
<Grid RowDefinitions="*,*,*" Column="0"> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsChartsColumnVisible}" />
<ColumnDefinition Width="*" behaviors:GridColumnHideBehavior.IsVisible="{Binding IsBarsColumnVisible}" />
</Grid.ColumnDefinitions>
<Grid Column="0" RowDefinitions="*,*,*">
<local:ResourceChartView Grid.Row="0" DataContext="{Binding CpuUsageChartViewModel}" /> <local:ResourceChartView Grid.Row="0" DataContext="{Binding CpuUsageChartViewModel}" />
<local:ResourceChartView Grid.Row="1" DataContext="{Binding CpuTemperatureChartViewModel}" /> <local:ResourceChartView Grid.Row="1" DataContext="{Binding CpuTemperatureChartViewModel}" />
<local:ResourceChartView Grid.Row="2" DataContext="{Binding MemoryUsageChartViewModel}" /> <local:ResourceChartView Grid.Row="2" DataContext="{Binding MemoryUsageChartViewModel}" />
</Grid> </Grid>
<Grid RowDefinitions="*,*,*" Column="1"> <Grid Column="1" RowDefinitions="*,*,*">
<local:ResourceCpuUsageBarsView Grid.Row="0" DataContext="{Binding CpuUsageBarsViewModel}" /> <local:ResourceCpuUsageBarsView Grid.Row="0" DataContext="{Binding CpuUsageBarsViewModel}" />
<local:ResourceBarView Grid.Row="1" DataContext="{Binding CpuTemperatureBarViewModel}" /> <local:ResourceBarView Grid.Row="1" DataContext="{Binding CpuTemperatureBarViewModel}" />
<local:ResourceBarView Grid.Row="2" DataContext="{Binding MemoryUsageBarViewModel}" /> <local:ResourceBarView Grid.Row="2" DataContext="{Binding MemoryUsageBarViewModel}" />
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>