Финализация рефакторинга
This commit is contained in:
@@ -0,0 +1,414 @@
|
||||
<UserControl
|
||||
x:Class="Pf2e.WPF.Start.Components.ProcessorCollectionControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="400"
|
||||
d:DesignWidth="300"
|
||||
x:ClassModifier="internal"
|
||||
BorderThickness="2,2,2,2"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="HeaderCheckbox" TargetType="{x:Type CheckBox}">
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
</Style>
|
||||
<Style x:Key="ElementBorder" TargetType="{x:Type Border}">
|
||||
<Setter Property="Margin" Value="10,5,10,20" />
|
||||
<Setter Property="BorderThickness" Value="1,1,1,1" />
|
||||
<Setter Property="BorderBrush" Value="Black" />
|
||||
</Style>
|
||||
<Style x:Key="ElementPanelStyle" TargetType="{x:Type WrapPanel}">
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlLightLightColorKey}}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style x:Key="ElementCheckBox" TargetType="CheckBox">
|
||||
<Setter Property="Margin" Value="4,2,4,2" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.Background>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}" />
|
||||
</UserControl.Background>
|
||||
|
||||
<ScrollViewer>
|
||||
<StackPanel
|
||||
x:Name="RootPanel"
|
||||
Margin="3,3,3,3"
|
||||
ScrollViewer.CanContentScroll="True">
|
||||
<CheckBox
|
||||
x:Name="Test"
|
||||
Content="Test Header 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<CheckBox
|
||||
Content="Test Header 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2 Test 2 Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<CheckBox
|
||||
Content="Test Header 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2 Test 2 Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<CheckBox
|
||||
Content="Test Header 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2 Test 2 Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<CheckBox
|
||||
Content="Test Header 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2 Test 2 Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<CheckBox
|
||||
Content="Test Header 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2 Test 2 Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<CheckBox
|
||||
Content="Test Header 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource HeaderCheckbox}" />
|
||||
<Border Style="{DynamicResource ElementBorder}">
|
||||
<WrapPanel Style="{StaticResource ElementPanelStyle}">
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2 Test 2 Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 1"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 2"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 3"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
<CheckBox
|
||||
Content="Test 4"
|
||||
IsChecked="False"
|
||||
Style="{DynamicResource ElementCheckBox}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,161 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using Pf2e.Scrapper.Processors.Attributes;
|
||||
using Pf2e.Scrapper.Processors.Attributes.Enum;
|
||||
using Pf2e.Scrapper.Processors.Collection;
|
||||
using CheckBox = System.Windows.Controls.CheckBox;
|
||||
|
||||
namespace Pf2e.WPF.Start.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Логика взаимодействия для ProcessorCollectionControl.xaml
|
||||
/// </summary>
|
||||
internal partial class ProcessorCollectionControl : System.Windows.Controls.UserControl
|
||||
{
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public ProcessorCollection Collection
|
||||
{
|
||||
get => _collection;
|
||||
set
|
||||
{
|
||||
_collection = value;
|
||||
SetContent();
|
||||
}
|
||||
}
|
||||
private ProcessorCollection _collection = null!;
|
||||
|
||||
public ProcessorCollectionControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private Dictionary<ProcessorGroupEnum, CheckBox> GroupCheckBoxes { get; } = [];
|
||||
|
||||
private Dictionary<ProcessorGroupEnum, bool?> GroupLastStats { get; } = [];
|
||||
|
||||
private Dictionary<string, CheckBox> ItemCheckBoxes { get; } = [];
|
||||
|
||||
private void SetContent()
|
||||
{
|
||||
RootPanel.Children.Clear();
|
||||
|
||||
foreach (ProcessorGroupEnum group in Enum.GetValues<ProcessorGroupEnum>())
|
||||
{
|
||||
GroupCheckBoxes[group] = new()
|
||||
{
|
||||
Content = group.ToString(),
|
||||
IsThreeState = true,
|
||||
Style = (Style)Resources["HeaderCheckbox"]!,
|
||||
};
|
||||
|
||||
GroupCheckBoxes[group].Click += GroupCheckBox_Click;
|
||||
|
||||
System.Windows.Controls.Border border = new()
|
||||
{
|
||||
Style = (Style)Resources["ElementBorder"]!,
|
||||
};
|
||||
|
||||
System.Windows.Controls.WrapPanel wrapPanel = new()
|
||||
{
|
||||
Style = (Style)Resources["ElementPanelStyle"]!,
|
||||
};
|
||||
|
||||
foreach (ProcessorRecord item in Collection.AllItems.Where(item => item.Group == group))
|
||||
{
|
||||
ItemCheckBoxes[item.Name] = new()
|
||||
{
|
||||
Content = item.Description,
|
||||
ToolTip = item.Name,
|
||||
IsChecked = item.Active,
|
||||
Style = (Style)Resources["ElementCheckBox"]!,
|
||||
};
|
||||
|
||||
ItemCheckBoxes[item.Name].Click += ItemCheckBox_Click;
|
||||
|
||||
wrapPanel.Children.Add(ItemCheckBoxes[item.Name]);
|
||||
}
|
||||
|
||||
border.Child = wrapPanel;
|
||||
|
||||
RootPanel.Children.Add(GroupCheckBoxes[group]);
|
||||
RootPanel.Children.Add(border);
|
||||
}
|
||||
|
||||
UpdateContent();
|
||||
}
|
||||
|
||||
private void UpdateContent()
|
||||
{
|
||||
GroupLastStats.Clear();
|
||||
List<string> checkedItems = [];
|
||||
|
||||
foreach ((string key, CheckBox? checkBox) in ItemCheckBoxes)
|
||||
{
|
||||
ProcessorRecord item = Collection[key];
|
||||
bool isChecked = checkBox.IsChecked ?? false;
|
||||
|
||||
if (GroupLastStats.TryGetValue(item.Group, out bool? state))
|
||||
{
|
||||
/*
|
||||
* | true | false | null
|
||||
* | Checked | Unchecked | Indeterminate
|
||||
* -------+---------+-----------+---------------
|
||||
* true | true | null | null
|
||||
* false | null | false | null
|
||||
*/
|
||||
|
||||
GroupLastStats[item.Group] =
|
||||
isChecked && state == true ? true
|
||||
: !isChecked && state == false ? false
|
||||
: null;
|
||||
}
|
||||
else
|
||||
{
|
||||
GroupLastStats[item.Group] = isChecked;
|
||||
}
|
||||
|
||||
if (isChecked)
|
||||
{
|
||||
checkedItems.Add(key);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ((ProcessorGroupEnum groupEnum, CheckBox? checkBox) in GroupCheckBoxes)
|
||||
{
|
||||
checkBox.IsChecked = GroupLastStats.GetValueOrDefault(groupEnum, null);
|
||||
}
|
||||
|
||||
Collection.FilterProcessors(checkedItems);
|
||||
}
|
||||
|
||||
private void GroupCheckBox_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
CheckBox groupCheckBox = (CheckBox)sender;
|
||||
|
||||
ProcessorGroupEnum groupEnum = GroupCheckBoxes
|
||||
.First(pair => pair.Value == groupCheckBox)
|
||||
.Key;
|
||||
|
||||
groupCheckBox.IsChecked =
|
||||
GroupLastStats[groupEnum] is null || groupCheckBox.IsChecked is not null;
|
||||
|
||||
foreach (
|
||||
(string _, CheckBox checkBox) in ItemCheckBoxes.Where(pair =>
|
||||
Collection[pair.Key].Group == groupEnum
|
||||
)
|
||||
)
|
||||
{
|
||||
checkBox.IsChecked = groupCheckBox.IsChecked;
|
||||
}
|
||||
|
||||
UpdateContent();
|
||||
}
|
||||
|
||||
private void ItemCheckBox_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateContent();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<Window
|
||||
x:Class="Pf2e.WPF.Start.StartForm"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:comp="clr-namespace:Pf2e.WPF.Start.Components"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="StartForm"
|
||||
Width="800"
|
||||
Height="600"
|
||||
x:ClassModifier="internal"
|
||||
Loaded="Window_Loaded"
|
||||
mc:Ignorable="d">
|
||||
<Window.Background>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}" />
|
||||
</Window.Background>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*" MinWidth="100" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="5*" MinWidth="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="3,3,3,3">
|
||||
<Button
|
||||
Margin="0,0,0,3"
|
||||
Click="ViewerButton_Click"
|
||||
Content="Просмотр сущностей" />
|
||||
<Button Content="Просмотр правил" />
|
||||
</StackPanel>
|
||||
|
||||
<Button
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="3,3,3,3"
|
||||
Click="StartButton_Click"
|
||||
Content="Старт" />
|
||||
|
||||
<GridSplitter
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="1"
|
||||
Width="5"
|
||||
HorizontalAlignment="Stretch" />
|
||||
|
||||
<comp:ProcessorCollectionControl
|
||||
x:Name="ProcessorCollectionControl"
|
||||
Grid.Row="0"
|
||||
Grid.RowSpan="2"
|
||||
Grid.Column="2" />
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,61 @@
|
||||
using System.Windows;
|
||||
using Pf2e.Scrapper;
|
||||
using Pf2e.Scrapper.Processors.Collection;
|
||||
|
||||
namespace Pf2e.WPF.Start;
|
||||
|
||||
/// <summary>
|
||||
/// Класс начальной формы приложения.
|
||||
/// </summary>
|
||||
internal partial class StartForm : Window
|
||||
{
|
||||
/// <summary>
|
||||
/// Коллекция обработчиков.
|
||||
/// </summary>
|
||||
public ProcessorCollection Collection { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Конструктор класса <see cref="StartForm"/>.
|
||||
/// </summary>
|
||||
/// <param name="collection">[DI] Коллекция обработчиков.</param>
|
||||
public StartForm(ProcessorCollection collection)
|
||||
{
|
||||
Collection = collection;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Событие загрузки формы.
|
||||
/// </summary>
|
||||
/// <param name="sender">Отправитель события.</param>
|
||||
/// <param name="e">Аргументы события.</param>
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ProcessorCollectionControl.Collection = Collection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Событие нажатия на кнопку просмотра сущностей.
|
||||
/// </summary>
|
||||
/// <param name="sender">Отправитель события.</param>
|
||||
/// <param name="e">Аргументы события.</param>
|
||||
private void ViewerButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ApplicationStateChange?.Invoke(this, ApplicationStage.Viewer);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Событие нажатия кнопки начала процесса импорта.
|
||||
/// </summary>
|
||||
/// <param name="sender">Отправитель события.</param>
|
||||
/// <param name="e">Аргументы события.</param>
|
||||
private void StartButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ApplicationStateChange?.Invoke(this, ApplicationStage.ImportProcess);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Событие изменения состояния приложения.
|
||||
/// </summary>
|
||||
public event ImportApplication.ApplicationStateChangeDelegate? ApplicationStateChange;
|
||||
}
|
||||
Reference in New Issue
Block a user