Исправления
This commit is contained in:
@@ -30,6 +30,8 @@ internal static class Program
|
|||||||
ImportApplication app = ActivatorUtilities.CreateInstance<ImportApplication>(
|
ImportApplication app = ActivatorUtilities.CreateInstance<ImportApplication>(
|
||||||
serviceProvider
|
serviceProvider
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Application.Run(app);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IServiceCollection RegisterServices()
|
private static IServiceCollection RegisterServices()
|
||||||
|
|||||||
@@ -40,27 +40,56 @@
|
|||||||
|
|
||||||
<DockPanel Style="{StaticResource {x:Type DockPanel}}">
|
<DockPanel Style="{StaticResource {x:Type DockPanel}}">
|
||||||
<DockPanel.Height>
|
<DockPanel.Height>
|
||||||
<DynamicResource ResourceKey="ItemHeight" />
|
<Binding Path="ItemHeight" RelativeSource="{RelativeSource AncestorType=local:EntityViewControl}" />
|
||||||
</DockPanel.Height>
|
</DockPanel.Height>
|
||||||
<StackPanel Width="200" Orientation="Horizontal">
|
<StackPanel Width="200" Orientation="Horizontal">
|
||||||
<Image>
|
<Image Margin="0,0,2,0">
|
||||||
<Image.Source>
|
<Image.Source>
|
||||||
<DrawingImage>
|
<MultiBinding Converter="{StaticResource LadderToImageConverter}">
|
||||||
<DrawingImage.Drawing>
|
<Binding Path="Ladder" />
|
||||||
<MultiBinding Converter="{StaticResource LadderToImageConverter}" ConverterParameter="{Binding ItemHeight, RelativeSource={RelativeSource AncestorType=local:EntityViewControl}}">
|
<Binding Path="ItemHeight" RelativeSource="{RelativeSource AncestorType=local:EntityViewControl}" />
|
||||||
<Binding Path="Depth" />
|
</MultiBinding>
|
||||||
<Binding Path="ItemHeight" RelativeSource="{RelativeSource AncestorType=local:EntityViewControl}"></Binding>
|
|
||||||
<DynamicResource ResourceKey="ItemHeight" />
|
|
||||||
</MultiBinding>
|
|
||||||
</DrawingImage.Drawing>
|
|
||||||
</DrawingImage>
|
|
||||||
</Image.Source>
|
</Image.Source>
|
||||||
</Image>
|
</Image>
|
||||||
<TextBlock Text="{Binding Name}" />
|
<Button
|
||||||
|
Width="15"
|
||||||
|
Height="15"
|
||||||
|
Margin="-24,0,0,0"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
BorderThickness="1"
|
||||||
|
Visibility="{Binding ButtonVisibility}">
|
||||||
|
<Button.Resources>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="CornerRadius" Value="3" />
|
||||||
|
<Setter Property="LineHeight" Value="15" />
|
||||||
|
</Style>
|
||||||
|
</Button.Resources>
|
||||||
|
<!--<Button.Width>
|
||||||
|
<Binding Path="ButtonSize" RelativeSource="{RelativeSource AncestorType=local:EntityViewControl}" />
|
||||||
|
</Button.Width>
|
||||||
|
<Button.Height>
|
||||||
|
<Binding Path="ButtonSize" RelativeSource="{RelativeSource AncestorType=local:EntityViewControl}" />
|
||||||
|
</Button.Height>-->
|
||||||
|
+
|
||||||
|
</Button>
|
||||||
|
<TextBlock
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{Binding Name}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock HorizontalAlignment="Center" Text="{Binding Type}" />
|
<TextBlock
|
||||||
<TextBlock HorizontalAlignment="Center" Text="{Binding Value}" />
|
Margin="0,0,5,0"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
FontSize="{Binding TypeFontSize, RelativeSource={RelativeSource AncestorType=local:EntityViewControl}}"
|
||||||
|
FontStyle="Italic"
|
||||||
|
Text="{Binding Type}" />
|
||||||
|
<TextBlock
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{Binding Value}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Pf2eDataScrapper.WPF.Components;
|
|||||||
|
|
||||||
internal partial class EntityViewControl : System.Windows.Controls.UserControl
|
internal partial class EntityViewControl : System.Windows.Controls.UserControl
|
||||||
{
|
{
|
||||||
public EntityViewViewModel ViewModel
|
public EntityViewViewModel? ViewModel
|
||||||
{
|
{
|
||||||
get => _viewModel;
|
get => _viewModel;
|
||||||
set
|
set
|
||||||
@@ -33,7 +33,7 @@ internal partial class EntityViewControl : System.Windows.Controls.UserControl
|
|||||||
DataContext = ViewModel;
|
DataContext = ViewModel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private EntityViewViewModel _viewModel;
|
private EntityViewViewModel? _viewModel;
|
||||||
|
|
||||||
#region "Поля элемента управления"
|
#region "Поля элемента управления"
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
using System.CodeDom;
|
using System.Globalization;
|
||||||
using System.Globalization;
|
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Header;
|
||||||
using Brush = System.Windows.Media.Brush;
|
|
||||||
using Brushes = System.Windows.Media.Brushes;
|
using Brushes = System.Windows.Media.Brushes;
|
||||||
using Color = System.Windows.Media.Color;
|
using Image = System.Windows.Controls.Image;
|
||||||
|
|
||||||
namespace Pf2eDataScrapper.WPF.ViewModels.EntityViewStructure;
|
namespace Pf2eDataScrapper.WPF.ViewModels.EntityViewStructure;
|
||||||
|
|
||||||
@@ -33,6 +30,11 @@ internal class StructureRow(StructureField item)
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Visible => Item.Visible;
|
public bool Visible => Item.Visible;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Флаг, указывающий, отображается ли строка.
|
||||||
|
/// </summary>
|
||||||
|
public Visibility ButtonVisibility => HasButton ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Глубина отображения поля.
|
/// Глубина отображения поля.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -68,9 +70,6 @@ internal class StructureRow(StructureField item)
|
|||||||
// [ValueConversion(typeof(IEnumerable<LadderType>), typeof(Image), ParameterType = typeof(int))]
|
// [ValueConversion(typeof(IEnumerable<LadderType>), typeof(Image), ParameterType = typeof(int))]
|
||||||
public class LadderToImageConverter : IMultiValueConverter
|
public class LadderToImageConverter : IMultiValueConverter
|
||||||
{
|
{
|
||||||
#region IValueConverter Members
|
|
||||||
|
|
||||||
|
|
||||||
public object? Convert(
|
public object? Convert(
|
||||||
object[] value,
|
object[] value,
|
||||||
Type targetType,
|
Type targetType,
|
||||||
@@ -78,7 +77,10 @@ public class LadderToImageConverter : IMultiValueConverter
|
|||||||
System.Globalization.CultureInfo culture
|
System.Globalization.CultureInfo culture
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (value.Length != 2)
|
if (
|
||||||
|
value.Length != 2
|
||||||
|
|| !value[0].GetType().IsAssignableTo(typeof(IEnumerable<LadderType>))
|
||||||
|
)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -91,19 +93,14 @@ public class LadderToImageConverter : IMultiValueConverter
|
|||||||
}
|
}
|
||||||
|
|
||||||
int n = ladder.Count();
|
int n = ladder.Count();
|
||||||
if (!int.TryParse((string)value[1], out int itemHeight))
|
int itemHeight = (int)value[1];
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawingGroup result = new();
|
DrawingGroup result = new();
|
||||||
|
|
||||||
// Rectangle
|
|
||||||
|
|
||||||
result.Children.Add(
|
result.Children.Add(
|
||||||
new GeometryDrawing()
|
new GeometryDrawing()
|
||||||
{
|
{
|
||||||
Geometry = new RectangleGeometry(new(0, 0, n * 100, 100)),
|
Geometry = new RectangleGeometry(new(0, 0, n * itemHeight, itemHeight)),
|
||||||
Pen = new(Brushes.Transparent, 0),
|
Pen = new(Brushes.Transparent, 0),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -116,16 +113,13 @@ public class LadderToImageConverter : IMultiValueConverter
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return result;
|
return new DrawingImage(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GeometryGroup GetLadderGeometryGroup(IEnumerable<LadderType> ladder, int h)
|
private GeometryGroup GetLadderGeometryGroup(IEnumerable<LadderType> ladder, int h)
|
||||||
{
|
{
|
||||||
float h2 = h * 0.5f;
|
|
||||||
GeometryGroup geometryGroup = new();
|
GeometryGroup geometryGroup = new();
|
||||||
|
float h2 = h * 0.5f;
|
||||||
//geometryGroup.Children.Add(new RectangleGeometry(new(0, 0, ladder.Count() * 100, 100)));
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
foreach (LadderType ladderType in ladder)
|
foreach (LadderType ladderType in ladder)
|
||||||
@@ -139,20 +133,23 @@ public class LadderToImageConverter : IMultiValueConverter
|
|||||||
new LineGeometry(new(i * h + h2, 0), new(i * h + h2, h2))
|
new LineGeometry(new(i * h + h2, 0), new(i * h + h2, h2))
|
||||||
);
|
);
|
||||||
geometryGroup.Children.Add(
|
geometryGroup.Children.Add(
|
||||||
new LineGeometry(new(i * h + h2, 50), new(i * h + h, h2))
|
new LineGeometry(new(i * h + h2, h2), new(i * h + h, h2))
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LadderType.Through:
|
case LadderType.Through:
|
||||||
geometryGroup.Children.Add(
|
geometryGroup.Children.Add(
|
||||||
new LineGeometry(new(i * h + h2, 0), new(i * h + h2, h))
|
new LineGeometry(new(i * h + h2, 0), new(i * h + h2, h))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (i == ladder.Count() - 1)
|
if (i == ladder.Count() - 1)
|
||||||
{
|
{
|
||||||
geometryGroup.Children.Add(
|
geometryGroup.Children.Add(
|
||||||
new LineGeometry(new(i * h + h2, h2), new(i * h + h2, h2))
|
new LineGeometry(new(i * h + h2, h2), new(i * h + h, h2))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(ladder));
|
throw new ArgumentOutOfRangeException(nameof(ladder));
|
||||||
}
|
}
|
||||||
@@ -172,6 +169,4 @@ public class LadderToImageConverter : IMultiValueConverter
|
|||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,4 @@
|
|||||||
using System;
|
using System.Collections.ObjectModel;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using Pf2eDataScrapper.Forms.Controls.EntityTreeViewer;
|
|
||||||
using Pf2eDataScrapper.Helpers;
|
using Pf2eDataScrapper.Helpers;
|
||||||
using Pf2eDataScrapper.WPF.Stores;
|
using Pf2eDataScrapper.WPF.Stores;
|
||||||
using Pf2eDataScrapper.WPF.ViewModels.EntityViewStructure;
|
using Pf2eDataScrapper.WPF.ViewModels.EntityViewStructure;
|
||||||
|
|||||||
Reference in New Issue
Block a user