Files
Pf2eDataScrapper/Pf2eViewer/TestForm.cs
T
2025-04-30 16:14:36 +04:00

40 lines
770 B
C#

using Pf2eModel;
using Pf2eModel.Model.Base;
namespace Pf2eViewer;
public partial class TestForm : Form
{
public Pf2eDbContext Context = new();
public int Count = 0;
public TestForm()
{
InitializeComponent();
}
public void RandomEntity()
{
int id = Random.Shared.Next(1, Count + 1);
Entity entity = Context.Entities.FirstOrDefault(e => e.Id == id)!;
EntityView view = new(Context, entity.Type, id);
entityTreeViewerControl1.EntityView = view;
}
private void TestForm_Load(object sender, EventArgs e)
{
Count = Context.Entities.Count();
RandomEntity();
}
private void RandomButton_Click(object sender, EventArgs e)
{
RandomEntity();
}
}