Files
Pf2eDataScrapper/Pf2eViewer/TestForm.cs
T

55 lines
1.1 KiB
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 DarkModeCS DarkMode;
public Pf2eDbContext Context = new();
public int Count = 0;
public TestForm()
{
InitializeComponent();
DarkMode = new DarkModeCS(this) { ColorMode = DarkModeCS.DisplayMode.SystemDefault };
entityTreeViewerControl1.DarkMode = DarkMode;
}
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();
}
}