forked from amkovkov/GranuSightSoftware2
266 lines
10 KiB
XML
266 lines
10 KiB
XML
<UserControl
|
|
x:Class="GSS2.Views.AmineContent.ExportView"
|
|
x:DataType="vm:ExportViewModel"
|
|
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:vm="using:GSS2.ViewModels.AmineContent"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns="https://github.com/avaloniaui"
|
|
>
|
|
|
|
<Grid Background="{StaticResource MainBackground}">
|
|
<Grid IsVisible="{Binding !DiskMounted}">
|
|
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
|
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" /> <!-- Подпись -->
|
|
<RowDefinition Height="Auto" /> <!-- Выбор диска/Кнопка "Обновить список" -->
|
|
<RowDefinition Height="*" /> <!-- Пустое пространство -->
|
|
<RowDefinition Height="Auto" /> <!-- Кнопка "Смонтировать диск" -->
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid.RowSpacing>5</Grid.RowSpacing>
|
|
|
|
<!-- Подпись -->
|
|
<TextBlock
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="0"
|
|
Text="Выберите диск:"
|
|
/>
|
|
<!-- Выбор диска -->
|
|
<ComboBox
|
|
Classes="singleline"
|
|
Grid.Column="0"
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Stretch"
|
|
IsEditable="False"
|
|
ItemsSource="{Binding Disks}"
|
|
PlaceholderText="Диск не выбран"
|
|
SelectedIndex="{Binding DisksSelectedIndex}"
|
|
>
|
|
|
|
<ComboBox.Styles>
|
|
|
|
<Style Selector="ComboBox /template/ ContentPresenter#PART_ContentPresenter">
|
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
</Style>
|
|
|
|
<Style Selector="ComboBoxItem">
|
|
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
</Style>
|
|
|
|
</ComboBox.Styles>
|
|
|
|
<ComboBox.ItemTemplate>
|
|
<DataTemplate x:DataType="vm:ExportViewModel+UsbDiskViewModel">
|
|
<TextBlock>
|
|
<Run Text="{Binding Name}" />
|
|
</TextBlock>
|
|
</DataTemplate>
|
|
</ComboBox.ItemTemplate>
|
|
</ComboBox>
|
|
|
|
<!-- Кнопка "Обновить список" -->
|
|
<Button
|
|
Command="{Binding RefreshDisksCommand}"
|
|
Grid.Column="1"
|
|
Grid.Row="1"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
VerticalContentAlignment="Center"
|
|
>
|
|
<TextBlock Text="Обновить список"/>
|
|
</Button>
|
|
|
|
<!-- Кнопка "Смонтировать диск" -->
|
|
<Button
|
|
Command="{Binding MountDiskCommand}"
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="3"
|
|
IsEnabled="{Binding Path=DisksSelectedIndex, Converter={StaticResource GreaterThanOrEqualConverter}, ConverterParameter=0}"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
VerticalContentAlignment="Center"
|
|
>
|
|
<TextBlock Text="Смонтировать диск"/>
|
|
</Button>
|
|
|
|
</Grid>
|
|
|
|
<Grid IsVisible="{Binding DiskMounted}">
|
|
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Grid.ColumnSpacing>5</Grid.ColumnSpacing>
|
|
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" /> <!-- Подпись -->
|
|
<RowDefinition Height="Auto" /> <!-- Кнопки -->
|
|
<RowDefinition Height="*" /> <!-- Список -->
|
|
<RowDefinition Height="Auto" /> <!-- Кнопки -->
|
|
<RowDefinition Height="Auto" /> <!-- Примечение -->
|
|
</Grid.RowDefinitions>
|
|
|
|
<Grid.RowSpacing>5</Grid.RowSpacing>
|
|
|
|
<!-- Подпись -->
|
|
<TextBlock
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="0"
|
|
Text="Выберите результатаы для экспорта:"
|
|
/>
|
|
<!-- Список -->
|
|
<ListBox
|
|
Background="{StaticResource MenuBackground}"
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="2"
|
|
ItemsSource="{Binding Records}"
|
|
SelectionMode="Multiple,Toggle"
|
|
SelectedItems="{Binding SelectedRecords}"
|
|
>
|
|
|
|
<!-- Шаблон списка элементов -->
|
|
<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 x:DataType="vm:ExportViewModel+RecordListViewModel">
|
|
<Border Margin="3" CornerRadius="5">
|
|
<TextBlock
|
|
Classes="mini"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
>
|
|
<Run Text="{Binding Id, StringFormat='[{0}] '}" />
|
|
<Run Text="{Binding SampleName}" />
|
|
</TextBlock>
|
|
</Border>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
|
|
</ListBox>
|
|
|
|
<!-- Кнопка "Экспортировать CSV" -->
|
|
<Button
|
|
Command="{Binding ExportCsvCommand}"
|
|
Grid.Column="0"
|
|
Grid.Row="3"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
VerticalContentAlignment="Center"
|
|
>
|
|
<TextBlock Text="Экспортировать CSV"/>
|
|
</Button>
|
|
|
|
<!-- Кнопка "Размонтировать диск" -->
|
|
<Button
|
|
Command="{Binding UnmountDiskCommand}"
|
|
Grid.Column="1"
|
|
Grid.Row="3"
|
|
HorizontalAlignment="Stretch"
|
|
VerticalAlignment="Stretch"
|
|
VerticalContentAlignment="Center"
|
|
>
|
|
<TextBlock Text="Размонтировать диск"/>
|
|
</Button>
|
|
|
|
<TextBlock
|
|
Grid.Column="0"
|
|
Grid.ColumnSpan="2"
|
|
Grid.Row="4"
|
|
HorizontalAlignment="Center"
|
|
Text="Перед извлечением диска обязательно размонтируйте его!"
|
|
TextWrapping="Wrap"
|
|
VerticalAlignment="Stretch"
|
|
/>
|
|
|
|
</Grid>
|
|
|
|
<Border
|
|
Classes.success="{Binding IsSuccessNotification}"
|
|
Classes.error="{Binding !IsSuccessNotification}"
|
|
IsVisible="{Binding IsNotificationVisible}"
|
|
VerticalAlignment="Top"
|
|
HorizontalAlignment="Stretch"
|
|
Margin="15"
|
|
Padding="15,10"
|
|
CornerRadius="8"
|
|
BoxShadow="0 4 10 0 #40000000">
|
|
|
|
<Border.Styles>
|
|
<Style Selector="Border.success">
|
|
<Setter Property="Background" Value="#2E7D32" />
|
|
</Style>
|
|
<Style Selector="Border.error">
|
|
<Setter Property="Background" Value="#C62828" />
|
|
</Style>
|
|
</Border.Styles>
|
|
|
|
<Grid ColumnDefinitions="*, Auto">
|
|
<TextBlock
|
|
Grid.Column="0"
|
|
Text="{Binding NotificationMessage}"
|
|
Foreground="White"
|
|
FontSize="16"
|
|
FontWeight="SemiBold"
|
|
TextWrapping="Wrap"
|
|
VerticalAlignment="Center"/>
|
|
|
|
<Button
|
|
Grid.Column="1"
|
|
Command="{Binding DismissNotificationCommand}"
|
|
Margin="10,0,0,0"
|
|
Padding="12,8"
|
|
Background="#33FFFFFF"
|
|
Foreground="White"
|
|
CornerRadius="5">
|
|
<TextBlock Text="✕" FontSize="16" FontWeight="Bold"/>
|
|
</Button>
|
|
</Grid>
|
|
</Border>
|
|
|
|
</Grid>
|
|
|
|
</UserControl> |