markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / MainViewModel.cs @ 3bde451b
이력 | 보기 | 이력해설 | 다운로드 (3.61 KB)
1 | 53c9637d | taeseongkim | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.Linq; |
||
4 | using System.ServiceModel; |
||
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
7 | 0498c12e | taeseongkim | using System.Windows; |
8 | using System.Windows.Controls.Primitives; |
||
9 | 45f9a2ad | taeseongkim | using System.Windows.Input; |
10 | 0498c12e | taeseongkim | using System.Windows.Media; |
11 | 45f9a2ad | taeseongkim | using Markus.Mvvm.ToolKit; |
12 | 53c9637d | taeseongkim | using Markus.Service.Helper; |
13 | 0498c12e | taeseongkim | using Markus.Service.StationController.Data; |
14 | 06f13e11 | taeseongkim | using Markus.Service.WcfClient.StationServiceTask; |
15 | 53c9637d | taeseongkim | |
16 | namespace Markus.Service.StationController.ViewModel |
||
17 | { |
||
18 | 45f9a2ad | taeseongkim | public class MainViewModel : ViewModelBase |
19 | 53c9637d | taeseongkim | { |
20 | 45f9a2ad | taeseongkim | #region 프로퍼티 |
21 | |||
22 | private string id; |
||
23 | |||
24 | public string Id |
||
25 | { |
||
26 | get => id; set |
||
27 | { |
||
28 | id = value; |
||
29 | OnPropertyChanged(() => Id); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | 0498c12e | taeseongkim | private bool isMenuOpen; |
34 | 45f9a2ad | taeseongkim | |
35 | 0498c12e | taeseongkim | public bool IsMenuOpen |
36 | 45f9a2ad | taeseongkim | { |
37 | 0498c12e | taeseongkim | get => isMenuOpen; set |
38 | 45f9a2ad | taeseongkim | { |
39 | 0498c12e | taeseongkim | isMenuOpen = value; |
40 | OnPropertyChanged(() => IsMenuOpen); |
||
41 | 45f9a2ad | taeseongkim | } |
42 | } |
||
43 | |||
44 | 0498c12e | taeseongkim | |
45 | 45f9a2ad | taeseongkim | |
46 | 0498c12e | taeseongkim | private List<MenuItem> navigationItems; |
47 | |||
48 | public List<MenuItem> NavigationItems |
||
49 | 45f9a2ad | taeseongkim | { |
50 | get => navigationItems; set |
||
51 | { |
||
52 | navigationItems = value; |
||
53 | 0157b158 | taeseongkim | OnPropertyChanged(() =>NavigationItems); |
54 | 45f9a2ad | taeseongkim | } |
55 | } |
||
56 | |||
57 | 0498c12e | taeseongkim | private MenuItem selectNavigationItem; |
58 | 45f9a2ad | taeseongkim | |
59 | 0498c12e | taeseongkim | public MenuItem SelectNavigationItem |
60 | 45f9a2ad | taeseongkim | { |
61 | get => selectNavigationItem; set |
||
62 | { |
||
63 | selectNavigationItem = value; |
||
64 | OnPropertyChanged(() => SelectNavigationItem); |
||
65 | } |
||
66 | } |
||
67 | |||
68 | #endregion 프로퍼티 |
||
69 | |||
70 | 0498c12e | taeseongkim | public override void Loaded() |
71 | 53c9637d | taeseongkim | { |
72 | 0498c12e | taeseongkim | base.Loaded(); |
73 | ed79bff0 | taeseongkim | |
74 | 0498c12e | taeseongkim | NavigationItems = new List<MenuItem> |
75 | ed79bff0 | taeseongkim | { |
76 | 2decfbdf | alzkakdixm | |
77 | new MenuItem |
||
78 | { |
||
79 | Name = "DataBase Items", |
||
80 | Description = "DataBase Items", |
||
81 | Content = new Views.DataBaseView() |
||
82 | }, |
||
83 | 3bde451b | semi | |
84 | new MenuItem |
||
85 | 0498c12e | taeseongkim | { |
86 | 3bde451b | semi | Name = "FinalPDF Items", |
87 | Description = "FinalPDF Items", |
||
88 | Content = new Views.FinalPDFView() |
||
89 | 6f6e7dbf | taeseongkim | }, |
90 | |||
91 | 2decfbdf | alzkakdixm | //new MenuItem |
92 | //{ |
||
93 | 3bde451b | semi | // Name = "Process Alive Items", |
94 | // Description = "Convert Station Alive Items", |
||
95 | // Content = new Views.AliveView() |
||
96 | //}, |
||
97 | |||
98 | //new MenuItem |
||
99 | //{ |
||
100 | 2decfbdf | alzkakdixm | // Name = "Convert Items", |
101 | // Description = "Convert Items", |
||
102 | // Content = new Views.MergeDataView() |
||
103 | //}, |
||
104 | 0498c12e | taeseongkim | new MenuItem |
105 | { |
||
106 | Name = "Settings", |
||
107 | Description = "Convert Station Settings", |
||
108 | Content = new Views.SettingsView() |
||
109 | } |
||
110 | ed79bff0 | taeseongkim | }; |
111 | |||
112 | 566f0526 | taeseongkim | SelectNavigationItem = NavigationItems.First(); |
113 | 53c9637d | taeseongkim | } |
114 | |||
115 | 0498c12e | taeseongkim | private void ListboxItemMouseUp() |
116 | 6396f27e | taeseongkim | { |
117 | 0498c12e | taeseongkim | var dependencyObject = Mouse.Captured as DependencyObject; |
118 | while (dependencyObject != null) |
||
119 | 6396f27e | taeseongkim | { |
120 | 0498c12e | taeseongkim | if (dependencyObject is ScrollBar) return; |
121 | dependencyObject = VisualTreeHelper.GetParent(dependencyObject); |
||
122 | 6396f27e | taeseongkim | } |
123 | |||
124 | 0498c12e | taeseongkim | IsMenuOpen = false; |
125 | 53c9637d | taeseongkim | } |
126 | |||
127 | 0498c12e | taeseongkim | #region Command |
128 | 6396f27e | taeseongkim | |
129 | 0498c12e | taeseongkim | private ICommand _ListboxItemMouseUpCommand; |
130 | public ICommand ListboxItemMouseUpCommand |
||
131 | 53c9637d | taeseongkim | { |
132 | 0498c12e | taeseongkim | get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp())); |
133 | 53c9637d | taeseongkim | } |
134 | |||
135 | 0498c12e | taeseongkim | #endregion |
136 | |||
137 | 53c9637d | taeseongkim | } |
138 | } |