markus / ConvertService / ServiceBase / Markus.Service.StationController / App.xaml.cs @ 47f89cbb
이력 | 보기 | 이력해설 | 다운로드 (2.41 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
4 |
using System.Configuration; |
5 |
using System.Data; |
6 |
using System.Linq; |
7 |
using System.Threading.Tasks; |
8 |
using System.Windows; |
9 |
|
10 |
namespace Markus.Service.StationController |
11 |
{ |
12 |
/// <summary> |
13 |
/// App.xaml에 대한 상호 작용 논리 |
14 |
/// </summary> |
15 |
public partial class App : Application |
16 |
{ |
17 |
|
18 |
public static bool IsDesignMode |
19 |
{ |
20 |
get |
21 |
{ |
22 |
return DesignerProperties.GetIsInDesignMode(new DependencyObject()); |
23 |
} |
24 |
private set { } |
25 |
} |
26 |
|
27 |
//private System.Windows.Forms.NotifyIcon _notifyIcon; |
28 |
//private bool _isExit; |
29 |
|
30 |
protected override void OnStartup(StartupEventArgs e) |
31 |
{ |
32 |
base.OnStartup(e); |
33 |
//MainWindow.Closing += MainWindow_Closing; |
34 |
|
35 |
//_notifyIcon = new System.Windows.Forms.NotifyIcon(); |
36 |
//_notifyIcon.DoubleClick += (s, args) => ShowMainWindow(); |
37 |
//_notifyIcon.Icon = Markus.Service.StationController.Properties.Resources.TRANSFER_ERROR; |
38 |
//_notifyIcon.Visible = true; |
39 |
|
40 |
//CreateContextMenu(); |
41 |
} |
42 |
|
43 |
private void CreateContextMenu() |
44 |
{ |
45 |
//_notifyIcon.ContextMenuStrip = |
46 |
// new System.Windows.Forms.ContextMenuStrip(); |
47 |
//_notifyIcon.ContextMenuStrip.Items.Add("MainWindow...").Click += (s, e) => ShowMainWindow(); |
48 |
//_notifyIcon.ContextMenuStrip.Items.Add("Exit").Click += (s, e) => ExitApplication(); |
49 |
} |
50 |
|
51 |
private void ExitApplication() |
52 |
{ |
53 |
//_isExit = true; |
54 |
//MainWindow.Close(); |
55 |
//_notifyIcon.Dispose(); |
56 |
//_notifyIcon = null; |
57 |
} |
58 |
|
59 |
private void ShowMainWindow() |
60 |
{ |
61 |
if (MainWindow.IsVisible) |
62 |
{ |
63 |
if (MainWindow.WindowState == WindowState.Minimized) |
64 |
{ |
65 |
MainWindow.WindowState = WindowState.Normal; |
66 |
} |
67 |
MainWindow.Activate(); |
68 |
} |
69 |
else |
70 |
{ |
71 |
MainWindow.Show(); |
72 |
} |
73 |
} |
74 |
|
75 |
//private void MainWindow_Closing(object sender, CancelEventArgs e) |
76 |
//{ |
77 |
// if (!_isExit) |
78 |
// { |
79 |
// e.Cancel = true; |
80 |
// MainWindow.Hide(); // A hidden window can be shown again, a closed one not |
81 |
// } |
82 |
//} |
83 |
|
84 |
} |
85 |
} |