tbf/GenesisCordonelInterface/UI/Debug/WorkerDebugPanel.cs

51 lines
1.4 KiB
C#

using System;
using System.Windows.Forms;
using GenesisCordonelInterface.API;
namespace GenesisCordonelInterface.UI.Debug
{
public partial class WorkerDebugPanel : UserControl
{
private readonly InterfaceOutsideToGCI api;
private readonly Timer timer = new Timer();
private readonly DataGridView grid = new DataGridView();
public WorkerDebugPanel(InterfaceOutsideToGCI api)
{
this.api = api;
grid.Dock = DockStyle.Fill;
grid.ReadOnly = true;
grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Controls.Add(grid);
timer.Interval = 300;
timer.Tick += (s, e) =>
{
grid.DataSource = null;
grid.DataSource = api.GetWorkerDebugStatuses();
};
timer.Start();
}
private void InitializeLayout()
{
grid.Dock = DockStyle.Fill;
grid.ReadOnly = true;
grid.AllowUserToAddRows = false;
grid.AllowUserToDeleteRows = false;
grid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
Controls.Add(grid);
Dock = DockStyle.Fill;
}
private void Timer_Tick(object sender, EventArgs e)
{
grid.DataSource = null;
grid.DataSource = api.GetWorkerDebugStatuses();
}
}
}