private void WindowSizeClosed(object sender, EventArgs e) { Trace.WriteLine("SizeSelectionWindow Closed"); SizeSelectionWindow window = (SizeSelectionWindow)sender; UnregisterEvent(window); _screens.Remove(window); CloseAllWindow(); }
public void Show() { Trace.WriteLine("Show SizeSelectionWindow HotKey"); if (_screens.Count != 0) { Trace.WriteLine("SizeSelectionWindows already opened"); return; } foreach (Screen screen in Screen.AllScreens) { var window = new SizeSelectionWindow(screen, _settings.Theme.NbItemsPerRow, _settings.Theme.NbItemsPerColumn, _settings); window.Show(); _screens.Add(window); } foreach (SizeSelectionWindow sizeSelectionWindow in _screens) { sizeSelectionWindow.Deactivated += WindowDeactivated; sizeSelectionWindow.SizeSelected += WindowSizeSelected; sizeSelectionWindow.Closed += WindowSizeClosed; } }
private void UnregisterEvent(SizeSelectionWindow sizeSelectionWindow) { sizeSelectionWindow.Deactivated -= WindowDeactivated; sizeSelectionWindow.SizeSelected -= WindowSizeSelected; sizeSelectionWindow.Closed -= WindowSizeClosed; }