49 lines
984 B
C#
49 lines
984 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
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();
|
|
}
|
|
}
|