private void Initialisation() { SettingsMenu settingsMenu = new SettingsMenu(); settingsMenu.MdiParent = this; // Setup the control panel. _controlPanel = new ControlPanel(settingsMenu); _controlPanel.Location = new Point(this.Width - _controlPanel.Width - 20, 10); _controlPanel.MdiParent = this; // note these two settings don't actually work for MDI child forms... _controlPanel.TopMost = true; _controlPanel.Opacity = .6; _controlPanel.OptionSelected += new CPOptionSelected(ControlPanel_OptionSelected); _controlPanel.Move += new EventHandler(ControlPanel_Move); // Setup default UI state RefreshDisplay(); if (WindowState == FormWindowState.Minimized) { Hide(); } //ValidateInstall(false); }
void Main_FormClosing(object sender, FormClosingEventArgs e) { bool closeMain = false; Cursor = Cursors.WaitCursor; try { EveMarketMonitorApp.Properties.Settings.Default.WindowState = this.WindowState; if (WindowState != FormWindowState.Minimized) { EveMarketMonitorApp.Properties.Settings.Default.WindowPos = this.Location; EveMarketMonitorApp.Properties.Settings.Default.WindowSize = this.Size; } EveMarketMonitorApp.Properties.Settings.Default.Save(); Logout(); if (_controlPanel == null && _updateStatus == null) { closeMain = true; } if (_controlPanel != null) { // Have to put this slightly wierd bit of code here to get the control panel to // close properly and allow the main window to close. _controlPanel.AllowClose = true; _controlPanel.Close(); _controlPanel = null; closeMain = true; } if (_updateStatus != null) { _updateStatus.AllowClose = true; _updateStatus.Close(); _updateStatus = null; closeMain = true; } if (_tutorialActive) { _tutorialThread.Abort(); _tutorialThread.Join(); } string tmpDir = Globals.AppDataDir + "Temp"; if (Directory.Exists(tmpDir)) { Directory.Delete(tmpDir, true); } string updateDir = Globals.AppDataDir + "Update"; if (Directory.Exists(updateDir)) { Directory.Delete(updateDir, true); } } finally { e.Cancel = !closeMain; } }
public void SetControlPanel(ControlPanel cp) { _cp = cp; }