Last change
on this file since 5955 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
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Windows.Forms;
|
---|
3 | using HeuristicLab.Clients.Hive.SlaveCore.Views;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.Clients.Hive.SlaveCore.SlaveTrayIcon {
|
---|
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();
|
---|
49 | } else {
|
---|
50 | if (Content != null) {
|
---|
51 | Content.StopAll();
|
---|
52 | }
|
---|
53 | }
|
---|
54 | }
|
---|
55 | }
|
---|
56 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.