Changeset 6730 for branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.TrayIcon/3.3/MainWindow.cs
- Timestamp:
- 09/09/11 20:19:43 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.TrayIcon/3.3/MainWindow.cs
r6698 r6730 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 2 22 using System.Windows.Forms; 3 23 using HeuristicLab.Clients.Hive.SlaveCore.Views; 4 using HeuristicLab.Clients.Hive.SlaveCore.Views.Properties;5 24 6 25 namespace HeuristicLab.Clients.Hive.SlaveCore.SlaveTrayIcon { … … 8 27 9 28 public SlaveItem Content { 10 get { return slave View.Content; }29 get { return slaveMainView.Content; } 11 30 set { 12 slaveView.Content = value; 13 logView.Content = value; 14 jobsView.Content = value; 15 Content.UserVisibleMessageFired += new EventHandler<Common.EventArgs<string>>(Content_UserVisibleMessageFired); 16 } 17 } 18 19 void Content_UserVisibleMessageFired(object sender, Common.EventArgs<string> e) { 20 if (Settings.Default.ShowBalloonTips) { 21 notifyIcon.ShowBalloonTip(2000, "HeuristicLab Hive", e.Value, ToolTipIcon.Info); 31 slaveMainView.Content = value; 22 32 } 23 33 } … … 25 35 public MainWindow() { 26 36 InitializeComponent(); 37 slaveMainView.WindowStateChanged += new System.EventHandler<Common.EventArgs<FormWindowState>>(slaveMainView_WindowStateChanged); 27 38 } 28 39 29 private void notifyIcon_DoubleClick(object sender, EventArgs e) { 30 if (WindowState == FormWindowState.Normal) { 31 MinimizeToTray(); 32 } else { 33 RestoreFromTray(); 40 void slaveMainView_WindowStateChanged(object sender, Common.EventArgs<FormWindowState> e) { 41 WindowState = e.Value; 42 if (WindowState == FormWindowState.Minimized) { 43 Hide(); 44 } else if (WindowState == FormWindowState.Normal) { 45 Show(); 34 46 } 35 47 } 36 48 37 private void closeToolStripMenuItem_Click(object sender, EventArgs e) {38 Application.Exit();49 internal void MinimizeToTray() { 50 slaveMainView.MinimizeToTray(); 39 51 } 40 52 41 private void showToolStripMenuItem_Click(object sender, EventArgs e) { 42 if (WindowState != FormWindowState.Normal) { 43 RestoreFromTray(); 44 } 45 } 46 47 public void MinimizeToTray() { 48 WindowState = FormWindowState.Minimized; 49 Hide(); 50 } 51 52 public void RestoreFromTray() { 53 Show(); 54 WindowState = FormWindowState.Normal; 55 } 56 57 private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { 58 if (e.CloseReason == CloseReason.UserClosing) { 59 e.Cancel = true; 60 MinimizeToTray(); 61 } 62 } 63 64 private void notifyIcon_BalloonTipClicked(object sender, EventArgs e) { 65 RestoreFromTray(); 66 } 67 68 private void homepageToolStripMenuItem_Click(object sender, EventArgs e) { 69 System.Diagnostics.Process.Start("http://dev.heuristiclab.com"); 53 internal void RestoreFromTray() { 54 slaveMainView.RestoreFromTray(); 70 55 } 71 56 }
Note: See TracChangeset
for help on using the changeset viewer.