private void ToolStripMenuItemDevManager_Click(object sender, EventArgs e) { if (deviceListWindow != null) { return; } deviceListWindow = new SavedDeviceListWindow(); deviceListWindow.FormClosing += SavedDeviceListWindow_FormClosing; deviceListWindow.DevList = deviceListFromConfig; var thread = new Thread(new ParameterizedThreadStart(param => { deviceListWindow.ShowDialog(); })); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
private void SavedDeviceListWindow_FormClosing(object sender, FormClosingEventArgs e) { deviceListWindow = null; }