markus / ConvertService / ServiceBase / Markus.Service.StationController / App.xaml.cs @ 45f9a2ad
이력 | 보기 | 이력해설 | 다운로드 (2.23 KB)
1 | 53c9637d | taeseongkim | 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 | 45f9a2ad | taeseongkim | //private System.Windows.Forms.NotifyIcon _notifyIcon; |
18 | //private bool _isExit; |
||
19 | 53c9637d | taeseongkim | |
20 | protected override void OnStartup(StartupEventArgs e) |
||
21 | { |
||
22 | base.OnStartup(e); |
||
23 | MainWindow = new MainWindow(); |
||
24 | a537d79a | taeseongkim | //MainWindow.Closing += MainWindow_Closing; |
25 | 53c9637d | taeseongkim | |
26 | a537d79a | taeseongkim | //_notifyIcon = new System.Windows.Forms.NotifyIcon(); |
27 | //_notifyIcon.DoubleClick += (s, args) => ShowMainWindow(); |
||
28 | //_notifyIcon.Icon = Markus.Service.StationController.Properties.Resources.TRANSFER_ERROR; |
||
29 | //_notifyIcon.Visible = true; |
||
30 | 53c9637d | taeseongkim | |
31 | a537d79a | taeseongkim | //CreateContextMenu(); |
32 | 53c9637d | taeseongkim | } |
33 | |||
34 | private void CreateContextMenu() |
||
35 | { |
||
36 | 45f9a2ad | taeseongkim | //_notifyIcon.ContextMenuStrip = |
37 | // new System.Windows.Forms.ContextMenuStrip(); |
||
38 | //_notifyIcon.ContextMenuStrip.Items.Add("MainWindow...").Click += (s, e) => ShowMainWindow(); |
||
39 | //_notifyIcon.ContextMenuStrip.Items.Add("Exit").Click += (s, e) => ExitApplication(); |
||
40 | 53c9637d | taeseongkim | } |
41 | |||
42 | private void ExitApplication() |
||
43 | { |
||
44 | 45f9a2ad | taeseongkim | //_isExit = true; |
45 | //MainWindow.Close(); |
||
46 | //_notifyIcon.Dispose(); |
||
47 | //_notifyIcon = null; |
||
48 | 53c9637d | taeseongkim | } |
49 | |||
50 | private void ShowMainWindow() |
||
51 | { |
||
52 | if (MainWindow.IsVisible) |
||
53 | { |
||
54 | if (MainWindow.WindowState == WindowState.Minimized) |
||
55 | { |
||
56 | MainWindow.WindowState = WindowState.Normal; |
||
57 | } |
||
58 | MainWindow.Activate(); |
||
59 | } |
||
60 | else |
||
61 | { |
||
62 | MainWindow.Show(); |
||
63 | } |
||
64 | } |
||
65 | |||
66 | 45f9a2ad | taeseongkim | //private void MainWindow_Closing(object sender, CancelEventArgs e) |
67 | //{ |
||
68 | // if (!_isExit) |
||
69 | // { |
||
70 | // e.Cancel = true; |
||
71 | // MainWindow.Hide(); // A hidden window can be shown again, a closed one not |
||
72 | // } |
||
73 | //} |
||
74 | 53c9637d | taeseongkim | |
75 | } |
||
76 | } |