Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/09/11 20:19:43 (13 years ago)
Author:
ascheibe
Message:

#1233 added Hive Slave HL App client

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
    222using System.Windows.Forms;
    323using HeuristicLab.Clients.Hive.SlaveCore.Views;
    4 using HeuristicLab.Clients.Hive.SlaveCore.Views.Properties;
    524
    625namespace HeuristicLab.Clients.Hive.SlaveCore.SlaveTrayIcon {
     
    827
    928    public SlaveItem Content {
    10       get { return slaveView.Content; }
     29      get { return slaveMainView.Content; }
    1130      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;
    2232      }
    2333    }
     
    2535    public MainWindow() {
    2636      InitializeComponent();
     37      slaveMainView.WindowStateChanged += new System.EventHandler<Common.EventArgs<FormWindowState>>(slaveMainView_WindowStateChanged);
    2738    }
    2839
    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();
    3446      }
    3547    }
    3648
    37     private void closeToolStripMenuItem_Click(object sender, EventArgs e) {
    38       Application.Exit();
     49    internal void MinimizeToTray() {
     50      slaveMainView.MinimizeToTray();
    3951    }
    4052
    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();
    7055    }
    7156  }
Note: See TracChangeset for help on using the changeset viewer.