forked from amkovkov/GranuSightSoftware2
feat: add brand calibration view and viewmodel
This commit is contained in:
@@ -0,0 +1,329 @@
|
||||
<UserControl
|
||||
x:Class="GSS2.Views.AmineContent.BrandCalibrationView"
|
||||
xmlns:controls="using:GSS2.Controls"
|
||||
xmlns:core="using:GSS2.UI.Core"
|
||||
xmlns:i="using:Avalonia.Xaml.Interactivity"
|
||||
xmlns:ia="using:Avalonia.Xaml.Interactions.Custom"
|
||||
xmlns:lvc="using:LiveChartsCore.SkiaSharpView.Avalonia"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:GSS2.ViewModels.AmineContent" x:DataType="vm:BrandCalibrationViewModel"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
>
|
||||
|
||||
<Grid Background="{StaticResource MainBackground}">
|
||||
|
||||
<!-- Основная форма -->
|
||||
<Grid IsEnabled="{Binding !MenuOpened}">
|
||||
|
||||
<Grid.RowSpacing>5</Grid.RowSpacing>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" /> <!-- Главная панель -->
|
||||
<RowDefinition Height="Auto" /> <!-- Кнопки главной панели -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" /> <!-- Кнопка "Удалить" -->
|
||||
<ColumnDefinition Width="*" /> <!-- Кнопка "Сохранить" -->
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Главная панель -->
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="0"
|
||||
>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" /> <!-- Кнопка меню -->
|
||||
<ColumnDefinition Width="*" /> <!-- Информация -->
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" /> <!-- Информация -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.RowSpacing>5</Grid.RowSpacing>
|
||||
|
||||
<!-- Кнопка меню -->
|
||||
<Button
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Stretch"
|
||||
Classes="vertical"
|
||||
Command="{Binding ToggleMenuCommand}"
|
||||
>
|
||||
<TextBlock Text="☰" />
|
||||
</Button>
|
||||
|
||||
<!-- Информация -->
|
||||
<Grid Grid.Column="1">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" /> <!-- Id (подпись) | Uuid (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- Id (поле ) | Uuid (поле ) -->
|
||||
<RowDefinition Height="Auto" /> <!-- BrandName (подпись) | MixtureName (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- BrandName (поле ) | MixtureName (поле ) -->
|
||||
<RowDefinition Height="Auto" /> <!-- MixtureNormalRate (подпись) -->
|
||||
<RowDefinition Height="Auto" /> <!-- MixtureNormalRate (поле ) -->
|
||||
<RowDefinition Height="*" /> <!-- Пустое пространство -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.RowSpacing>5</Grid.RowSpacing>
|
||||
|
||||
<!-- Id (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Text="ИД:"
|
||||
/>
|
||||
<!-- Id (поле) -->
|
||||
<TextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
IsReadOnly="True"
|
||||
PlaceholderText="ИД"
|
||||
Text="{Binding SelectedId}"
|
||||
/>
|
||||
<!-- Uuid (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
Text="Уникальный ИД:"
|
||||
/>
|
||||
<!-- Uuid (поле) -->
|
||||
<TextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
IsReadOnly="True"
|
||||
PlaceholderText="Уникальный ИД"
|
||||
Text="{Binding SelectedUuid}"
|
||||
/>
|
||||
<!-- BrandName (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
Grid.Column="0"
|
||||
Grid.Row="2"
|
||||
Text="Марка продукта:"
|
||||
/>
|
||||
<!-- BrandName (поле) -->
|
||||
<controls:TouchTextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="0"
|
||||
Grid.Row="3"
|
||||
PlaceholderText="Марка продукта"
|
||||
Text="{Binding SelectedBrandName}"
|
||||
/>
|
||||
<!-- MixtureName (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
Text="Марка смеси:"
|
||||
/>
|
||||
<!-- MixtureName (поле) -->
|
||||
<controls:TouchTextBox
|
||||
Classes="singleline"
|
||||
Grid.Column="1"
|
||||
Grid.Row="3"
|
||||
PlaceholderText="Марка смеси"
|
||||
Text="{Binding SelectedMixtureName}"
|
||||
/>
|
||||
<!-- MixtureNormalRate (подпись) -->
|
||||
<TextBlock
|
||||
Classes="mini" Text="Норма расхода смеси (кг/т | гр/кг):"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="4"
|
||||
/>
|
||||
<!-- MixtureNormalRate (поле) -->
|
||||
<controls:TouchNumericUpDown
|
||||
Classes="singleline"
|
||||
FormatString="0.0000"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="5"
|
||||
Increment="0.0001"
|
||||
PlaceholderText="Норма расхода смеси (кг/т | гр/кг)"
|
||||
Value="{Binding SelectedMixtureNormalRate}"
|
||||
/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Кнопки главной панели -->
|
||||
<!-- Кнопка "Удалить" -->
|
||||
<Button
|
||||
Classes="danger"
|
||||
Command="{Binding DeleteRecordCommand}"
|
||||
Grid.Column="0"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
>
|
||||
<TextBlock Text="Удалить" />
|
||||
</Button>
|
||||
|
||||
<!-- Кнопка "Сохранить" -->
|
||||
<Button
|
||||
Command="{Binding SaveRecordCommand}"
|
||||
Content="Сохранить"
|
||||
Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Stretch"
|
||||
>
|
||||
<TextBlock Text="Сохранить" />
|
||||
</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Полупрозрачный оверлей -->
|
||||
<Border
|
||||
Background="{StaticResource Overlay}"
|
||||
IsEnabled="{Binding MenuOpened}"
|
||||
IsVisible="{Binding MenuOpened}"
|
||||
>
|
||||
<Interaction.Behaviors>
|
||||
<TappedTrigger>
|
||||
<InvokeCommandAction Command="{Binding CloseMenuCommand}" />
|
||||
</TappedTrigger>
|
||||
</Interaction.Behaviors>
|
||||
</Border>
|
||||
|
||||
<!-- Выезжающая боковая панель -->
|
||||
<Border
|
||||
Background="{StaticResource MenuBackground}"
|
||||
BorderBrush="{StaticResource MenuBorder}"
|
||||
BorderThickness="0,0,1,0"
|
||||
HorizontalAlignment="Left"
|
||||
IsEnabled="{Binding MenuOpened}"
|
||||
IsVisible="{Binding MenuOpened}"
|
||||
>
|
||||
|
||||
<!-- Переходы -->
|
||||
<Border.Transitions>
|
||||
<Transitions>
|
||||
<TransformOperationsTransition Duration="0:0:0.25" Property="RenderTransform" />
|
||||
</Transitions>
|
||||
</Border.Transitions>
|
||||
|
||||
<!-- Поведения -->
|
||||
<Interaction.Behaviors>
|
||||
|
||||
<!-- Поведение при открытии меню -->
|
||||
<DataTriggerBehavior
|
||||
Binding="{Binding MenuOpened}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="True"
|
||||
>
|
||||
<ChangePropertyAction PropertyName="RenderTransform" Value="translateX(0px)" />
|
||||
</DataTriggerBehavior>
|
||||
|
||||
<!-- Поведение при закрытии меню -->
|
||||
<DataTriggerBehavior
|
||||
Binding="{Binding MenuOpened}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="False"
|
||||
>
|
||||
<ChangePropertyAction PropertyName="RenderTransform" Value="translateX(-320px)" />
|
||||
</DataTriggerBehavior>
|
||||
|
||||
</Interaction.Behaviors>
|
||||
|
||||
<!-- Содержимое меню -->
|
||||
<Grid Margin="10">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" /> <!-- Кнопка "Новая запись" -->
|
||||
<RowDefinition Height="*" /> <!-- Элементы меню -->
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.RowSpacing>10</Grid.RowSpacing>
|
||||
|
||||
<!-- Кнопка "Новая запись" -->
|
||||
<Button
|
||||
Command="{Binding CreateRecordCommand}"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
MinWidth="200"
|
||||
>
|
||||
<TextBlock Text="Новая запись" />
|
||||
</Button>
|
||||
|
||||
<!-- Элементы меню -->
|
||||
<ListBox
|
||||
Background="{StaticResource MenuBackground}"
|
||||
Grid.Row="1"
|
||||
ItemsSource="{Binding MenuItems}"
|
||||
SelectedIndex="{Binding MenuSelectedIndex}"
|
||||
>
|
||||
|
||||
<!-- Шаблон списка элементов -->
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
|
||||
<!-- Стили элементов -->
|
||||
<ListBox.Styles>
|
||||
|
||||
<!-- Общий стиль -->
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Background" Value="{StaticResource ButtonBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Стиль выбранного элемента -->
|
||||
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource MainBackground}" />
|
||||
</Style>
|
||||
|
||||
<!-- Стиль элемента над которым находится указатель -->
|
||||
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource MainBackground}" />
|
||||
</Style>
|
||||
|
||||
</ListBox.Styles>
|
||||
|
||||
<!-- Шаблон элемента -->
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Margin="3" CornerRadius="5">
|
||||
<TextBlock
|
||||
Classes="mini"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
>
|
||||
<Run Text="{Binding Id, StringFormat='[{0}] '}" />
|
||||
<Run Text="{Binding BrandName}" />
|
||||
<Run Text=" - " />
|
||||
<Run Text="{Binding MixtureName}" />
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
</ListBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,11 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace GSS2.Views.AmineContent;
|
||||
|
||||
public partial class BrandCalibrationView : UserControl
|
||||
{
|
||||
public BrandCalibrationView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user