forked from amkovkov/GranuSightSoftware2
feat: add Camera View and ViewModel
This commit is contained in:
@@ -2,10 +2,11 @@ using CommunityToolkit.Mvvm.ComponentModel;
|
|||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
|
||||||
using GSS2.UI.Core.Services;
|
using GSS2.UI.Core.Services;
|
||||||
using GSS2.UI.Core.ViewModels;
|
|
||||||
using GSS2.ViewModels.Common;
|
using GSS2.ViewModels.Common;
|
||||||
using GSS2.ViewModels.AmineContent;
|
using GSS2.ViewModels.AmineContent;
|
||||||
|
|
||||||
|
using ViewModelBase = GSS2.UI.Core.ViewModels.ViewModelBase;
|
||||||
|
|
||||||
namespace GSS2.ViewModels;
|
namespace GSS2.ViewModels;
|
||||||
|
|
||||||
public partial class AmineContentViewModel : ViewModelBase
|
public partial class AmineContentViewModel : ViewModelBase
|
||||||
@@ -17,6 +18,7 @@ public partial class AmineContentViewModel : ViewModelBase
|
|||||||
[ObservableProperty] public partial ResultsViewModel Results { get; set; }
|
[ObservableProperty] public partial ResultsViewModel Results { get; set; }
|
||||||
[ObservableProperty] public partial SampleCalibrationViewModel SampleCalibration { get; set; }
|
[ObservableProperty] public partial SampleCalibrationViewModel SampleCalibration { get; set; }
|
||||||
[ObservableProperty] public partial SeparatorCalibrationViewModel SeparatorCalibration { get; set; }
|
[ObservableProperty] public partial SeparatorCalibrationViewModel SeparatorCalibration { get; set; }
|
||||||
|
[ObservableProperty] public partial CameraViewModel Camera { get; set; }
|
||||||
[ObservableProperty] public partial SystemViewModel System { get; set; }
|
[ObservableProperty] public partial SystemViewModel System { get; set; }
|
||||||
|
|
||||||
[ObservableProperty] public partial int CurrentIndex { get; set; }
|
[ObservableProperty] public partial int CurrentIndex { get; set; }
|
||||||
@@ -28,6 +30,7 @@ public partial class AmineContentViewModel : ViewModelBase
|
|||||||
ResultsViewModel results,
|
ResultsViewModel results,
|
||||||
SampleCalibrationViewModel sampleCalibration,
|
SampleCalibrationViewModel sampleCalibration,
|
||||||
SeparatorCalibrationViewModel separatorCalibration,
|
SeparatorCalibrationViewModel separatorCalibration,
|
||||||
|
CameraViewModel camera,
|
||||||
SystemViewModel system
|
SystemViewModel system
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -37,6 +40,7 @@ public partial class AmineContentViewModel : ViewModelBase
|
|||||||
Results = results;
|
Results = results;
|
||||||
SampleCalibration = sampleCalibration;
|
SampleCalibration = sampleCalibration;
|
||||||
SeparatorCalibration = separatorCalibration;
|
SeparatorCalibration = separatorCalibration;
|
||||||
|
Camera = camera;
|
||||||
System = system;
|
System = system;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
|
||||||
|
using GSS2.UI.Core.ViewModels;
|
||||||
|
|
||||||
|
namespace GSS2.ViewModels.Common;
|
||||||
|
|
||||||
|
public partial class CameraViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
[ObservableProperty] public partial GSS2.UI.Core.ViewModels.CameraViewModel Camera { get; set; }
|
||||||
|
[ObservableProperty] public partial GSS2.UI.Core.ViewModels.IlluminatorControllerViewModel Illuminator { get; set; }
|
||||||
|
|
||||||
|
public CameraViewModel(
|
||||||
|
GSS2.UI.Core.ViewModels.CameraViewModel camera,
|
||||||
|
GSS2.UI.Core.ViewModels.IlluminatorControllerViewModel illuminator
|
||||||
|
)
|
||||||
|
{
|
||||||
|
Camera = camera;
|
||||||
|
Illuminator = illuminator;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@
|
|||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
|
|
||||||
<Border Background="{StaticResource MainBackground}" BorderThickness="0">
|
<Border Background="{StaticResource MainBackground}" BorderThickness="0">
|
||||||
|
|
||||||
<Grid Margin="5" RowSpacing="5">
|
<Grid Margin="5" RowSpacing="5">
|
||||||
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -51,6 +52,7 @@
|
|||||||
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Результаты -->
|
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Результаты -->
|
||||||
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Калибровка проб -->
|
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Калибровка проб -->
|
||||||
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Калибровка сепаратора -->
|
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Калибровка сепаратора -->
|
||||||
|
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Камера -->
|
||||||
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Системная страница -->
|
<ColumnDefinition Width="*" MinWidth="200"/> <!-- Системная страница -->
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
@@ -79,8 +81,13 @@
|
|||||||
<TextBlock Classes="menu-text" Text="Калибровка сепаратора"/>
|
<TextBlock Classes="menu-text" Text="Калибровка сепаратора"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- Системная страница -->
|
<!-- Камера -->
|
||||||
<Button Grid.Column="5" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="5">
|
<Button Grid.Column="5" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="5">
|
||||||
|
<TextBlock Classes="menu-text" Text="Камера"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- Системная страница -->
|
||||||
|
<Button Grid.Column="6" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="6">
|
||||||
<TextBlock Classes="menu-text" Text="Системная страница"/>
|
<TextBlock Classes="menu-text" Text="Системная страница"/>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
@@ -94,6 +101,7 @@
|
|||||||
<ContentControl Content="{Binding Results}"/> <!-- Результаты -->
|
<ContentControl Content="{Binding Results}"/> <!-- Результаты -->
|
||||||
<ContentControl Content="{Binding SampleCalibration}"/> <!-- Калибровка проб -->
|
<ContentControl Content="{Binding SampleCalibration}"/> <!-- Калибровка проб -->
|
||||||
<ContentControl Content="{Binding SeparatorCalibration}"/> <!-- Калибровка сепаратора -->
|
<ContentControl Content="{Binding SeparatorCalibration}"/> <!-- Калибровка сепаратора -->
|
||||||
|
<ContentControl Content="{Binding Camera}"/> <!-- Камера -->
|
||||||
<ContentControl Content="{Binding System}"/> <!-- Системная страница -->
|
<ContentControl Content="{Binding System}"/> <!-- Системная страница -->
|
||||||
</core:SectionPanel>
|
</core:SectionPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="GSS2.Views.Common.CameraView"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:GSS2.ViewModels.Common"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
x:DataType="vm:CameraViewModel">
|
||||||
|
|
||||||
|
<UserControl.Resources>
|
||||||
|
<SolidColorBrush x:Key="MainBackground" Color="#001e46" />
|
||||||
|
<SolidColorBrush x:Key="ButtonBackground" Color="#0865b2" />
|
||||||
|
<SolidColorBrush x:Key="ButtonForeground" Color="#ffffff" />
|
||||||
|
<x:Double x:Key="ButtonFontSize">20</x:Double>
|
||||||
|
</UserControl.Resources>
|
||||||
|
|
||||||
|
<UserControl.Styles>
|
||||||
|
|
||||||
|
<Style Selector="Button">
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||||
|
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||||
|
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
|
||||||
|
<Setter Property="Foreground" Value="{StaticResource ButtonForeground}" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="TextBlock">
|
||||||
|
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||||
|
<Setter Property="TextAlignment" Value="Center"/>
|
||||||
|
<Setter Property="FontSize" Value="{StaticResource ButtonFontSize}"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</UserControl.Styles>
|
||||||
|
|
||||||
|
<Border BorderThickness="0">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/> <!-- Камера -->
|
||||||
|
<ColumnDefinition Width="Auto"/> <!-- Осветитель -->
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<ContentControl Grid.Column="0" Content="{Binding Camera}"/> <!-- Камера -->
|
||||||
|
|
||||||
|
<ContentControl Grid.Column="1" Content="{Binding Illuminator}"/> <!-- Осветитель -->
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace GSS2.Views.Common;
|
||||||
|
|
||||||
|
public partial class CameraView : UserControl
|
||||||
|
{
|
||||||
|
public CameraView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user