Глобальное обновление #1

Merged
kozhilya merged 33 commits from dev into master 2025-06-01 22:28:15 +04:00
11 changed files with 56 additions and 32 deletions
Showing only changes of commit 00de4cb319 - Show all commits
@@ -36,9 +36,16 @@ internal class ProcessProgress : AbstractLogger
ProgressMessage?.Invoke(this, level, message); ProgressMessage?.Invoke(this, level, message);
} }
public void Complete()
{
ProgressComplete?.Invoke(this);
}
public delegate void ProgressUpdateDelegate(ProcessProgress sender); public delegate void ProgressUpdateDelegate(ProcessProgress sender);
public event ProgressUpdateDelegate? ProgressUpdate; public event ProgressUpdateDelegate? ProgressUpdate;
public event ProgressUpdateDelegate? ProgressComplete;
public delegate void ProgressMessageDelegate( public delegate void ProgressMessageDelegate(
ProcessProgress sender, ProcessProgress sender,
LogLevel level, LogLevel level,
@@ -94,6 +94,7 @@ internal sealed class ProcessorExecutor(
else else
{ {
Progress.Processors.Complete(); Progress.Processors.Complete();
Progress.Complete();
} }
} }
@@ -3,7 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Pf2eDataScrapper.WPF.Components"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewmodel="clr-namespace:Pf2eDataScrapper.WPF.EntityViewer.ViewModel" xmlns:viewmodel="clr-namespace:Pf2eDataScrapper.WPF.EntityViewer.ViewModel"
Padding="3,3,3,3" Padding="3,3,3,3"
@@ -1,6 +1,5 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Windows; using System.Windows;
using Pf2eDataScrapper.WPF.Components;
using Pf2eDataScrapper.WPF.EntityViewer.ViewModel; using Pf2eDataScrapper.WPF.EntityViewer.ViewModel;
using Pf2eModel; using Pf2eModel;
using Pf2eModel.Model.Enum; using Pf2eModel.Model.Enum;
@@ -1,16 +1,17 @@
<Window <Window
x:Class="Pf2eDataScrapper.WPF.ProgressForm" x:Class="Pf2eDataScrapper.WPF.ProgressForm.ProgressForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Pf2eDataScrapper.WPF" xmlns:local="clr-namespace:Pf2eDataScrapper.WPF.ProgressForm"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="ProgressWindow" x:Name="_this"
Title="Выполняется обработка..." Title="Выполняется обработка..."
Width="400" Width="400"
Height="500" Height="500"
x:ClassModifier="internal" x:ClassModifier="internal"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Margin="3,3,3,3"> <Grid Margin="3,3,3,3">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@@ -42,40 +43,52 @@
<ListView <ListView
x:Name="MessageListView" x:Name="MessageListView"
Grid.Row="5" Grid.Row="5"
ItemsSource="{Binding ViewRows}" ItemsSource="{Binding ViewRows, ElementName=_this}"
ScrollViewer.CanContentScroll="True"> ScrollViewer.CanContentScroll="True">
<ListView.Resources>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="Margin" Value="0" />
<Setter Property="Padding" Value="0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Foreground" Value="Black" />
<Style.Triggers>
<DataTrigger Binding="{Binding Level}" Value="Progress">
<Setter Property="Background" Value="LightGray" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListView.Resources>
<ListView.View> <ListView.View>
<GridView> <GridView>
<GridViewColumn Width="Auto" Header="Время" /> <GridViewColumn
<GridViewColumn Width="Auto" Header="Тип" /> Width="Auto"
<GridViewColumn Width="Auto" Header="Сообщение" /> DisplayMemberBinding="{Binding Time}"
Header="Время" />
<GridViewColumn
Width="Auto"
DisplayMemberBinding="{Binding Level}"
Header="Тип" />
<GridViewColumn DisplayMemberBinding="{Binding Message}" Header="Сообщение" />
</GridView> </GridView>
</ListView.View> </ListView.View>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate DataType="{x:Type local:ListViewRow}"> <DataTemplate>
<Grid> <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="70" />
<ColumnDefinition Width="70" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Background="{Binding Path=Color}" Background="{Binding Path=Color}" />
Text="{Binding Path=Time}" />
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Background="{Binding Path=Color}" Background="{Binding Path=Color}" />
Text="{Binding Path=Level}" />
<TextBlock <TextBlock
Grid.Column="2" Grid.Column="2"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Background="{Binding Path=Color}" Background="{Binding Path=Color}" />
Text="{Binding Path=Message}" />
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>
@@ -4,7 +4,7 @@ using System.Drawing;
using System.Windows; using System.Windows;
using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Helpers;
namespace Pf2eDataScrapper.WPF; namespace Pf2eDataScrapper.WPF.ProgressForm;
/// <summary> /// <summary>
/// Логика взаимодействия для ProgressFormWpf.xaml /// Логика взаимодействия для ProgressFormWpf.xaml
@@ -23,8 +23,10 @@ internal partial class ProgressForm : Window
Progress.ProgressUpdate += Progress_ProgressUpdate; Progress.ProgressUpdate += Progress_ProgressUpdate;
Progress.ProgressMessage += Progress_ProgressMessage; Progress.ProgressMessage += Progress_ProgressMessage;
Progress.ProgressComplete += Progress_ProgressComplete;
} }
private void Progress_ProgressUpdate(ProcessProgress sender) private void Progress_ProgressUpdate(ProcessProgress sender)
{ {
if (!Dispatcher.CheckAccess()) if (!Dispatcher.CheckAccess())
@@ -53,6 +55,12 @@ internal partial class ProgressForm : Window
ListViewRow item = new(level, message) { IsVisible = true }; ListViewRow item = new(level, message) { IsVisible = true };
ViewRows.Add(item); ViewRows.Add(item);
MessageListView.ScrollIntoView(item);
}
private void Progress_ProgressComplete(ProcessProgress sender)
{
//(Application.Current as ImportApplication)!.CurrentStage = ApplicationStage.Viewer;
} }
public event ImportApplication.ApplicationStateChangeDelegate? ApplicationStateChange; public event ImportApplication.ApplicationStateChangeDelegate? ApplicationStateChange;
@@ -1,5 +1,5 @@
<UserControl <UserControl
x:Class="Pf2eDataScrapper.WPF.Components.ProcessorCollectionControl" x:Class="Pf2eDataScrapper.WPF.StartForm.Components.ProcessorCollectionControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -6,7 +6,7 @@ using System.Windows;
using Pf2eDataScrapper.App; using Pf2eDataScrapper.App;
using CheckBox = System.Windows.Controls.CheckBox; using CheckBox = System.Windows.Controls.CheckBox;
namespace Pf2eDataScrapper.WPF.Components; namespace Pf2eDataScrapper.WPF.StartForm.Components;
/// <summary> /// <summary>
/// Логика взаимодействия для ProcessorCollectionControl.xaml /// Логика взаимодействия для ProcessorCollectionControl.xaml
@@ -1,8 +1,8 @@
<Window <Window
x:Class="Pf2eDataScrapper.WPF.Views.StartForm" x:Class="Pf2eDataScrapper.WPF.StartForm.StartForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:components="clr-namespace:Pf2eDataScrapper.WPF.Components" xmlns:comp="clr-namespace:Pf2eDataScrapper.WPF.StartForm.Components"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Pf2eDataScrapper.WPF" xmlns:local="clr-namespace:Pf2eDataScrapper.WPF"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@@ -52,10 +52,11 @@
Width="5" Width="5"
HorizontalAlignment="Stretch" /> HorizontalAlignment="Stretch" />
<components:ProcessorCollectionControl <comp:ProcessorCollectionControl
x:Name="ProcessorCollectionControl" x:Name="ProcessorCollectionControl"
Grid.Row="0" Grid.Row="0"
Grid.RowSpan="2" Grid.RowSpan="2"
Grid.Column="2" /> Grid.Column="2" />
</Grid> </Grid>
</Window> </Window>
@@ -1,11 +1,8 @@
using System.Windows; using System.Windows;
using Pf2eDataScrapper.App; using Pf2eDataScrapper.App;
namespace Pf2eDataScrapper.WPF.Views; namespace Pf2eDataScrapper.WPF.StartForm;
/// <summary>
/// Логика взаимодействия для StartForm.xaml
/// </summary>
internal partial class StartForm : Window internal partial class StartForm : Window
{ {
public ProcessorCollection Collection { get; } public ProcessorCollection Collection { get; }
@@ -1,5 +1,4 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Pf2eDataScrapper.WPF.Components;
using Pf2eDataScrapper.WPF.EntityViewer.Stores; using Pf2eDataScrapper.WPF.EntityViewer.Stores;
using Pf2eDataScrapper.WPF.EntityViewer.ViewModel; using Pf2eDataScrapper.WPF.EntityViewer.ViewModel;