Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive.Slave.SlaveTrayIcon/MainWindow.cs @ 6219

Last change on this file since 6219 was 5599, checked in by ascheibe, 14 years ago

#1233

  • rename 'Slave' namespace to 'SlaveCore' (and assemblies etc) to avoid problems with 'Slave' class
  • use svcutil (OKB-style)
File size: 1.4 KB
RevLine 
[5314]1using System;
2using System.Windows.Forms;
[5599]3using HeuristicLab.Clients.Hive.SlaveCore.Views;
[5314]4
[5599]5namespace HeuristicLab.Clients.Hive.SlaveCore.SlaveTrayIcon {
[5314]6  public partial class MainWindow : Form {
7
8    public SlaveItem Content {
9      get { return slaveView.Content; }
10      set { slaveView.Content = value; }
11    }
12
13    public MainWindow() {
14      InitializeComponent();
15    }
16
17    private void notifyIcon_DoubleClick(object sender, EventArgs e) {
18      if (WindowState == FormWindowState.Normal) {
19        MinimizeToTray();
20      } else {
21        RestoreFromTray();
22      }
23    }
24
25    private void closeToolStripMenuItem_Click(object sender, EventArgs e) {
26      Application.Exit();
27    }
28
29    private void showToolStripMenuItem_Click(object sender, EventArgs e) {
30      if (WindowState != FormWindowState.Normal) {
31        RestoreFromTray();
32      }
33    }
34
35    public void MinimizeToTray() {
36      WindowState = FormWindowState.Minimized;
37      Hide();
38    }
39
40    private void RestoreFromTray() {
41      Show();
42      WindowState = FormWindowState.Normal;
43    }
44
45    private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) {
46      if (e.CloseReason == CloseReason.UserClosing) {
47        e.Cancel = true;
48        MinimizeToTray();
[5320]49      } else {
50        if (Content != null) {
[5451]51          Content.StopAll();
[5320]52        }
[5314]53      }
54    }
55  }
56}
Note: See TracBrowser for help on using the repository browser.