Возврат к основной форме (но есть ошибка при запуске...)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Pf2eModel;
|
||||
using Pf2eModel.Model.Base;
|
||||
using Pf2eModel.Model.Common.I18n;
|
||||
@@ -10,13 +11,7 @@ public partial class DatabaseViewerControl : UserControl
|
||||
{
|
||||
public readonly Pf2eDbContext Context = new();
|
||||
|
||||
private int _perPage = 30;
|
||||
|
||||
private int _page = 1;
|
||||
|
||||
private EntityType _type;
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int PerPage
|
||||
{
|
||||
get => _perPage;
|
||||
@@ -26,6 +21,7 @@ public partial class DatabaseViewerControl : UserControl
|
||||
UpdateView();
|
||||
}
|
||||
}
|
||||
private int _perPage = 30;
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Page
|
||||
@@ -37,14 +33,7 @@ public partial class DatabaseViewerControl : UserControl
|
||||
UpdateView();
|
||||
}
|
||||
}
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Count { get; private set; }
|
||||
|
||||
public int MaxPage => Convert.ToInt32(Math.Ceiling(1.0 * Count / PerPage));
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public EntityView CurrentEntity { get; private set; } = null!;
|
||||
private int _page = 1;
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public EntityType Type
|
||||
@@ -56,6 +45,16 @@ public partial class DatabaseViewerControl : UserControl
|
||||
UpdateView();
|
||||
}
|
||||
}
|
||||
private EntityType _type;
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Count { get; private set; } = 0;
|
||||
|
||||
public int MaxPage => Convert.ToInt32(Math.Ceiling(1.0 * Count / PerPage));
|
||||
|
||||
[AllowNull]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public EntityView CurrentEntity { get; private set; }
|
||||
|
||||
private bool _updating = false;
|
||||
|
||||
|
||||
Generated
+30
-36
@@ -1,4 +1,6 @@
|
||||
namespace Pf2eViewer;
|
||||
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
|
||||
|
||||
namespace Pf2eViewer;
|
||||
|
||||
partial class MainViewForm
|
||||
{
|
||||
@@ -31,23 +33,21 @@ partial class MainViewForm
|
||||
RootSplitContainer = new SplitContainer();
|
||||
InnerSplitContainer = new SplitContainer();
|
||||
TypesListBox = new ListBox();
|
||||
DatabaseViewer = new DatabaseViewerControl();
|
||||
ResultSplitContainer = new SplitContainer();
|
||||
JsonWebView = new Microsoft.Web.WebView2.WinForms.WebView2();
|
||||
EntityTreeViewerControl = new Pf2eViewer.EntityTreeViewer.EntityTreeViewerControl();
|
||||
DatabaseViewer = new DatabaseViewerControl();
|
||||
DescriptionTextBox = new TextBox();
|
||||
((System.ComponentModel.ISupportInitialize) RootSplitContainer).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)RootSplitContainer).BeginInit();
|
||||
RootSplitContainer.Panel1.SuspendLayout();
|
||||
RootSplitContainer.Panel2.SuspendLayout();
|
||||
RootSplitContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize) InnerSplitContainer).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)InnerSplitContainer).BeginInit();
|
||||
InnerSplitContainer.Panel1.SuspendLayout();
|
||||
InnerSplitContainer.Panel2.SuspendLayout();
|
||||
InnerSplitContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize) ResultSplitContainer).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).BeginInit();
|
||||
ResultSplitContainer.Panel1.SuspendLayout();
|
||||
ResultSplitContainer.Panel2.SuspendLayout();
|
||||
ResultSplitContainer.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize) JsonWebView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// RootSplitContainer
|
||||
@@ -79,32 +79,30 @@ partial class MainViewForm
|
||||
// InnerSplitContainer.Panel1
|
||||
//
|
||||
InnerSplitContainer.Panel1.Controls.Add(TypesListBox);
|
||||
InnerSplitContainer.Size = new Size(254, 688);
|
||||
InnerSplitContainer.SplitterDistance = 102;
|
||||
InnerSplitContainer.TabIndex = 1;
|
||||
//
|
||||
// InnerSplitContainer.Panel2
|
||||
//
|
||||
InnerSplitContainer.Panel2.Controls.Add(DatabaseViewer);
|
||||
InnerSplitContainer.Size = new Size(254, 688);
|
||||
InnerSplitContainer.SplitterDistance = 102;
|
||||
InnerSplitContainer.TabIndex = 1;
|
||||
//
|
||||
// TypesListBox
|
||||
//
|
||||
TypesListBox.Dock = DockStyle.Fill;
|
||||
TypesListBox.FormattingEnabled = true;
|
||||
TypesListBox.ItemHeight = 15;
|
||||
TypesListBox.Location = new Point(0, 0);
|
||||
TypesListBox.Name = "TypesListBox";
|
||||
TypesListBox.Size = new Size(254, 102);
|
||||
TypesListBox.TabIndex = 0;
|
||||
TypesListBox.SelectedIndexChanged += TypesListBox_SelectedIndexChanged;
|
||||
//
|
||||
// EntityView
|
||||
// DatabaseViewer
|
||||
//
|
||||
DatabaseViewer.Dock = DockStyle.Fill;
|
||||
DatabaseViewer.Location = new Point(0, 0);
|
||||
DatabaseViewer.Name = "DatabaseViewer";
|
||||
DatabaseViewer.Size = new Size(254, 582);
|
||||
DatabaseViewer.TabIndex = 0;
|
||||
DatabaseViewer.TabIndex = 1;
|
||||
//
|
||||
// ResultSplitContainer
|
||||
//
|
||||
@@ -114,38 +112,36 @@ partial class MainViewForm
|
||||
//
|
||||
// ResultSplitContainer.Panel1
|
||||
//
|
||||
ResultSplitContainer.Panel1.Controls.Add(JsonWebView);
|
||||
ResultSplitContainer.Panel1.Controls.Add(EntityTreeViewerControl);
|
||||
//
|
||||
// ResultSplitContainer.Panel2
|
||||
//
|
||||
ResultSplitContainer.Panel2.Controls.Add(DescriptionTextBox);
|
||||
ResultSplitContainer.Size = new Size(923, 688);
|
||||
ResultSplitContainer.SplitterDistance = 467;
|
||||
ResultSplitContainer.SplitterDistance = 382;
|
||||
ResultSplitContainer.TabIndex = 1;
|
||||
//
|
||||
// JsonWebView
|
||||
// EntityTreeViewerControl
|
||||
//
|
||||
JsonWebView.AllowExternalDrop = true;
|
||||
JsonWebView.CreationProperties = null;
|
||||
JsonWebView.DefaultBackgroundColor = Color.White;
|
||||
JsonWebView.Dock = DockStyle.Fill;
|
||||
JsonWebView.Location = new Point(0, 0);
|
||||
JsonWebView.Name = "JsonWebView";
|
||||
JsonWebView.Size = new Size(467, 688);
|
||||
JsonWebView.TabIndex = 0;
|
||||
JsonWebView.Visible = false;
|
||||
JsonWebView.ZoomFactor = 1D;
|
||||
JsonWebView.CoreWebView2InitializationCompleted += JsonWebView_CoreWebView2InitializationCompleted;
|
||||
EntityTreeViewerControl.DepthSize = 20;
|
||||
EntityTreeViewerControl.Dock = DockStyle.Fill;
|
||||
EntityTreeViewerControl.EntityView = null;
|
||||
EntityTreeViewerControl.ItemHeight = 20;
|
||||
EntityTreeViewerControl.Location = new Point(0, 0);
|
||||
EntityTreeViewerControl.Name = "EntityTreeViewerControl";
|
||||
EntityTreeViewerControl.Size = new Size(382, 688);
|
||||
EntityTreeViewerControl.TabIndex = 0;
|
||||
//
|
||||
// DescriptionTextBox
|
||||
//
|
||||
DescriptionTextBox.Dock = DockStyle.Fill;
|
||||
DescriptionTextBox.Font = new Font("Consolas", 9F);
|
||||
DescriptionTextBox.Location = new Point(0, 0);
|
||||
DescriptionTextBox.Multiline = true;
|
||||
DescriptionTextBox.Name = "DescriptionTextBox";
|
||||
DescriptionTextBox.ReadOnly = true;
|
||||
DescriptionTextBox.ScrollBars = ScrollBars.Vertical;
|
||||
DescriptionTextBox.Size = new Size(452, 688);
|
||||
DescriptionTextBox.Size = new Size(537, 688);
|
||||
DescriptionTextBox.TabIndex = 0;
|
||||
//
|
||||
// MainViewForm
|
||||
@@ -158,18 +154,16 @@ partial class MainViewForm
|
||||
Text = "DataBaseViewer";
|
||||
RootSplitContainer.Panel1.ResumeLayout(false);
|
||||
RootSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize) RootSplitContainer).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)RootSplitContainer).EndInit();
|
||||
RootSplitContainer.ResumeLayout(false);
|
||||
InnerSplitContainer.Panel1.ResumeLayout(false);
|
||||
InnerSplitContainer.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize) InnerSplitContainer).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)InnerSplitContainer).EndInit();
|
||||
InnerSplitContainer.ResumeLayout(false);
|
||||
ResultSplitContainer.Panel1.ResumeLayout(false);
|
||||
ResultSplitContainer.Panel2.ResumeLayout(false);
|
||||
ResultSplitContainer.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize) ResultSplitContainer).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)ResultSplitContainer).EndInit();
|
||||
ResultSplitContainer.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize) JsonWebView).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
@@ -180,6 +174,6 @@ partial class MainViewForm
|
||||
private ListBox TypesListBox;
|
||||
private SplitContainer ResultSplitContainer;
|
||||
private TextBox DescriptionTextBox;
|
||||
private Microsoft.Web.WebView2.WinForms.WebView2 JsonWebView;
|
||||
private DatabaseViewerControl DatabaseViewer;
|
||||
private EntityTreeViewer.EntityTreeViewerControl EntityTreeViewerControl;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Pf2eModel;
|
||||
@@ -16,7 +17,8 @@ public partial class MainViewForm : Form
|
||||
|
||||
public readonly string JsonViewerHtml;
|
||||
|
||||
public readonly EntityView Viewer;
|
||||
[AllowNull]
|
||||
public readonly EntityView Viewer = null;
|
||||
|
||||
public MainViewForm()
|
||||
{
|
||||
@@ -67,7 +69,8 @@ public partial class MainViewForm : Form
|
||||
|
||||
string json = result[..^1] + $",\"SubEntity\":{subResult}}}";
|
||||
|
||||
RenderJson(json);
|
||||
EntityTreeViewerControl.EntityView = newEntity;
|
||||
// RenderJson(json);
|
||||
|
||||
DescriptionTextBox.Text = newEntity.Entity!.Description;
|
||||
}
|
||||
@@ -85,6 +88,7 @@ public partial class MainViewForm : Form
|
||||
|
||||
public void RenderJson(string json)
|
||||
{
|
||||
/*
|
||||
if (JsonWebView.CoreWebView2 == null)
|
||||
{
|
||||
JsonWebView.EnsureCoreWebView2Async();
|
||||
@@ -93,14 +97,6 @@ public partial class MainViewForm : Form
|
||||
|
||||
string html = JsonViewerHtml.Replace("{JSON}", json);
|
||||
JsonWebView.CoreWebView2.NavigateToString(html);
|
||||
}
|
||||
|
||||
private void JsonWebView_CoreWebView2InitializationCompleted(
|
||||
object sender,
|
||||
Microsoft.Web.WebView2.Core.CoreWebView2InitializationCompletedEventArgs e
|
||||
)
|
||||
{
|
||||
JsonWebView.Visible = true;
|
||||
DatabaseViewer_EntityChange(DatabaseViewer.CurrentEntity);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,16 +8,15 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FontAwesome.Sharp" Version="6.6.0" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3179.45" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Pf2eModel\Pf2eModel.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
</None>
|
||||
<None Update="Resources\json-viewer.html">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -11,7 +11,14 @@ internal static class Program
|
||||
// To customize application configuration such as set high DPI settings or default font,
|
||||
// see https://aka.ms/applicationconfiguration.
|
||||
ApplicationConfiguration.Initialize();
|
||||
// Application.Run(new MainViewForm());
|
||||
Application.Run(new TestForm());
|
||||
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
|
||||
#pragma warning disable WFO5001
|
||||
Application.SetColorMode(SystemColorMode.System);
|
||||
#pragma warning restore WFO5001
|
||||
|
||||
Application.Run(new MainViewForm() { StartPosition = FormStartPosition.CenterScreen });
|
||||
// Application.Run(new TestForm() { StartPosition = FormStartPosition.CenterScreen });
|
||||
}
|
||||
}
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Этот код создан программой.
|
||||
// Исполняемая версия:4.0.30319.42000
|
||||
//
|
||||
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||
// повторной генерации кода.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Pf2eViewer.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
</SettingsFile>
|
||||
Generated
+1
@@ -37,6 +37,7 @@ partial class TestForm
|
||||
// RandomButton
|
||||
//
|
||||
RandomButton.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
RandomButton.FlatStyle = FlatStyle.System;
|
||||
RandomButton.Location = new Point(12, 12);
|
||||
RandomButton.Name = "RandomButton";
|
||||
RandomButton.Size = new Size(426, 23);
|
||||
|
||||
Reference in New Issue
Block a user