using System; using System.Diagnostics; using System.Drawing; using System.Windows.Forms; namespace DD2Switcher { public partial class WindowPanelForm : UserControl { public event EventHandler PickClicked; public event EventHandler UntrackClicked; public int WindowIndex { get; set; } public Process WindowProcess { get; set; } public bool IsFirst { get; set; } public bool IsLast { get; set; } public WindowPanelForm() { InitializeComponent(); } public void UpdateDisplay() { if (WindowProcess != null) { indexLabel.Text = $"Index: {WindowIndex}"; nameLabel.Text = $"Name: {WindowProcess.ProcessName}"; pidLabel.Text = $"PID: {WindowProcess.Id}"; titleLabel.Text = $"Title: {WindowProcess.MainWindowTitle}"; if (IsFirst && IsLast) { firstLastLabel.Text = "First & Last"; } else if (IsFirst) { firstLastLabel.Text = "First"; } else if (IsLast) { firstLastLabel.Text = "Last"; } else { firstLastLabel.Text = ""; } } } private void pickButton_Click(object sender, EventArgs e) { PickClicked?.Invoke(this, WindowIndex); } private void untrackButton_Click(object sender, EventArgs e) { UntrackClicked?.Invoke(this, WindowIndex); } } }