forked from amkovkov/GranuSightSoftware2
feat: AmineContent View and ViewModel base
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
using GSS2.UI.Core.Services;
|
||||
using GSS2.Views;
|
||||
using GSS2.ViewModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using GSS2.ViewModels.Common;
|
||||
using GSS2.ViewModels.AmineContent;
|
||||
|
||||
namespace GSS2;
|
||||
|
||||
@@ -23,5 +25,11 @@ public static class DependencyInjectionHelper
|
||||
.AddSingleton<MainView>()
|
||||
.AddSingleton<MainViewModel>()
|
||||
.AddSingleton<AmineContentView>()
|
||||
.AddSingleton<AmineContentViewModel>();
|
||||
.AddSingleton<AmineContentViewModel>()
|
||||
.AddSingleton<SystemViewModel>()
|
||||
.AddSingleton<StartViewModel>()
|
||||
.AddSingleton<AnalysisViewModel>()
|
||||
.AddSingleton<ResultsViewModel>()
|
||||
.AddSingleton<SampleCalibrationViewModel>()
|
||||
.AddSingleton<SeparatorCalibrationViewModel>();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
|
||||
namespace GSS2.ViewModels.AmineContent;
|
||||
|
||||
public partial class AnalysisViewModel : ViewModelBase
|
||||
{
|
||||
public AnalysisViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
|
||||
namespace GSS2.ViewModels.AmineContent;
|
||||
|
||||
public partial class ResultsViewModel : ViewModelBase
|
||||
{
|
||||
public ResultsViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
|
||||
namespace GSS2.ViewModels.AmineContent;
|
||||
|
||||
public partial class SampleCalibrationViewModel : ViewModelBase
|
||||
{
|
||||
public SampleCalibrationViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
|
||||
namespace GSS2.ViewModels.AmineContent;
|
||||
|
||||
public partial class SeparatorCalibrationViewModel : ViewModelBase
|
||||
{
|
||||
public SeparatorCalibrationViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
|
||||
namespace GSS2.ViewModels.AmineContent;
|
||||
|
||||
public partial class StartViewModel : ViewModelBase
|
||||
{
|
||||
public StartViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
||||
using GSS2.UI.Core.Services;
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
using GSS2.ViewModels.Common;
|
||||
using GSS2.ViewModels.AmineContent;
|
||||
|
||||
namespace GSS2.ViewModels;
|
||||
|
||||
public partial class AmineContentViewModel : ViewModelBase
|
||||
{
|
||||
private readonly NavigationService _navigationService;
|
||||
|
||||
[ObservableProperty] public partial StartViewModel Start { get; set; }
|
||||
[ObservableProperty] public partial AnalysisViewModel Analysis { get; set; }
|
||||
[ObservableProperty] public partial ResultsViewModel Results { get; set; }
|
||||
[ObservableProperty] public partial SampleCalibrationViewModel SampleCalibration { get; set; }
|
||||
[ObservableProperty] public partial SeparatorCalibrationViewModel SeparatorCalibration { get; set; }
|
||||
[ObservableProperty] public partial SystemViewModel System { get; set; }
|
||||
|
||||
[ObservableProperty] public partial int CurrentIndex { get; set; }
|
||||
|
||||
public AmineContentViewModel(
|
||||
NavigationService navigationService,
|
||||
StartViewModel start,
|
||||
AnalysisViewModel analysis,
|
||||
ResultsViewModel results,
|
||||
SampleCalibrationViewModel sampleCalibration,
|
||||
SeparatorCalibrationViewModel separatorCalibration,
|
||||
SystemViewModel system
|
||||
)
|
||||
{
|
||||
_navigationService = navigationService;
|
||||
Start = start;
|
||||
Analysis = analysis;
|
||||
Results = results;
|
||||
SampleCalibration = sampleCalibration;
|
||||
SeparatorCalibration = separatorCalibration;
|
||||
System = system;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
void ChangeSection(string sectionNumberStr)
|
||||
{
|
||||
if (!int.TryParse(sectionNumberStr, out var sectionNumber))
|
||||
return;
|
||||
CurrentIndex = sectionNumber;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using GSS2.UI.Core.ViewModels;
|
||||
|
||||
namespace GSS2.ViewModels.Common;
|
||||
|
||||
public partial class SystemViewModel : ViewModelBase
|
||||
{
|
||||
public SystemViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<UserControl
|
||||
x:Class="GSS2.Views.AmineContentView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:GSS2.ViewModels"
|
||||
xmlns:core="using:GSS2.UI.Core"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
x:DataType="vm:AmineContentViewModel">
|
||||
|
||||
<UserControl.Resources>
|
||||
<SolidColorBrush x:Key="MainBackground" Color="#001e46" />
|
||||
<SolidColorBrush x:Key="ButtonBackground" Color="#0865b2" />
|
||||
<SolidColorBrush x:Key="ButtonForeground" Color="#ffffff" />
|
||||
</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.menu">
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock.menu-text">
|
||||
<Setter Property="FontSize" Value="20"/>
|
||||
</Style>
|
||||
|
||||
</UserControl.Styles>
|
||||
|
||||
<Border Background="{StaticResource MainBackground}" BorderThickness="0">
|
||||
<Grid Margin="5" RowSpacing="5">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/> <!-- Меню -->
|
||||
<RowDefinition Height="*"/> <!-- Основной контент -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Меню -->
|
||||
<ScrollViewer Grid.Row="0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
|
||||
<Grid ColumnSpacing="5">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<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>
|
||||
|
||||
<!-- Начальная страница -->
|
||||
<Button Grid.Column="0" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="0">
|
||||
<TextBlock Classes="menu-text" Text="Начальная страница"/>
|
||||
</Button>
|
||||
|
||||
<!-- Анализ -->
|
||||
<Button Grid.Column="1" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="1">
|
||||
<TextBlock Classes="menu-text" Text="Анализ"/>
|
||||
</Button>
|
||||
|
||||
<!-- Результаты -->
|
||||
<Button Grid.Column="2" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="2">
|
||||
<TextBlock Classes="menu-text" Text="Результаты"/>
|
||||
</Button>
|
||||
|
||||
<!-- Калибровка проб -->
|
||||
<Button Grid.Column="3" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="3">
|
||||
<TextBlock Classes="menu-text" Text="Калибровка проб"/>
|
||||
</Button>
|
||||
|
||||
<!-- Калибровка сепаратора -->
|
||||
<Button Grid.Column="4" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="4">
|
||||
<TextBlock Classes="menu-text" Text="Калибровка сепаратора"/>
|
||||
</Button>
|
||||
|
||||
<!-- Системная страница -->
|
||||
<Button Grid.Column="5" Classes="menu" Command="{Binding ChangeSectionCommand}" CommandParameter="5">
|
||||
<TextBlock Classes="menu-text" Text="Системная страница"/>
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
<!-- Основной контент -->
|
||||
<core:SectionPanel Grid.Row="1" ClipToBounds="True" CurrentIndex="{Binding CurrentIndex}" Orientation="Horizontal">
|
||||
<ContentControl Content="{Binding Start}"/> <!-- Начальная страница -->
|
||||
<ContentControl Content="{Binding Analysis}"/> <!-- Анализ -->
|
||||
<ContentControl Content="{Binding Results}"/> <!-- Результаты -->
|
||||
<ContentControl Content="{Binding SampleCalibration}"/> <!-- Калибровка проб -->
|
||||
<ContentControl Content="{Binding SeparatorCalibration}"/> <!-- Калибровка сепаратора -->
|
||||
<ContentControl Content="{Binding System}"/> <!-- Системная страница -->
|
||||
</core:SectionPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace GSS2.Views;
|
||||
|
||||
public partial class AmineContentView : UserControl
|
||||
{
|
||||
public AmineContentView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user