markus / ConvertService / ServiceController / Markus.Service.StationController / ViewModel / MainViewModel.cs @ 4d701de6
이력 | 보기 | 이력해설 | 다운로드 (3.56 KB)
1 | 5c387707 | semi | 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 | using System.Windows; |
||
8 | using System.Windows.Controls.Primitives; |
||
9 | using System.Windows.Input; |
||
10 | using System.Windows.Media; |
||
11 | using Markus.Mvvm.ToolKit; |
||
12 | using Markus.Service.Helper; |
||
13 | using Markus.Service.StationController.Data; |
||
14 | using Markus.Service.WcfClient.StationServiceTask; |
||
15 | |||
16 | namespace Markus.Service.StationController.ViewModel |
||
17 | { |
||
18 | public class MainViewModel : ViewModelBase |
||
19 | { |
||
20 | #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 | private bool isMenuOpen; |
||
34 | |||
35 | public bool IsMenuOpen |
||
36 | { |
||
37 | get => isMenuOpen; set |
||
38 | { |
||
39 | isMenuOpen = value; |
||
40 | OnPropertyChanged(() => IsMenuOpen); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | |||
45 | |||
46 | private List<MenuItem> navigationItems; |
||
47 | |||
48 | public List<MenuItem> NavigationItems |
||
49 | { |
||
50 | get => navigationItems; set |
||
51 | { |
||
52 | navigationItems = value; |
||
53 | OnPropertyChanged(() =>NavigationItems); |
||
54 | } |
||
55 | } |
||
56 | |||
57 | private MenuItem selectNavigationItem; |
||
58 | |||
59 | public MenuItem SelectNavigationItem |
||
60 | { |
||
61 | get => selectNavigationItem; set |
||
62 | { |
||
63 | selectNavigationItem = value; |
||
64 | OnPropertyChanged(() => SelectNavigationItem); |
||
65 | } |
||
66 | } |
||
67 | |||
68 | #endregion 프로퍼티 |
||
69 | |||
70 | public override void Loaded() |
||
71 | { |
||
72 | base.Loaded(); |
||
73 | |||
74 | Application.Current.MainWindow.Height = System.Windows.SystemParameters.WorkArea.Height * 0.8; |
||
75 | Application.Current.MainWindow.Width = System.Windows.SystemParameters.WorkArea.Width * 0.8; |
||
76 | |||
77 | |||
78 | NavigationItems = new List<MenuItem> |
||
79 | { |
||
80 | |||
81 | new MenuItem |
||
82 | { |
||
83 | Name = "DataBase Items", |
||
84 | Description = "DataBase Items", |
||
85 | Content = new Views.DataBaseView() |
||
86 | }, |
||
87 | |||
88 | new MenuItem |
||
89 | { |
||
90 | Name = "FinalPDF Items", |
||
91 | Description = "FinalPDF Items", |
||
92 | Content = new Views.FinalPDFView() |
||
93 | }, |
||
94 | |||
95 | 919dee1b | semi | new MenuItem |
96 | 5c387707 | semi | { |
97 | Name = "Dash Board", |
||
98 | Description = "Dash Board", |
||
99 | Content = new Views.DashBoard() |
||
100 | }, |
||
101 | |||
102 | 919dee1b | semi | new MenuItem |
103 | { |
||
104 | Name = "Markup 조회", |
||
105 | Description = "마크업 조회", |
||
106 | Content = new Views.Markup_Check() |
||
107 | }, |
||
108 | |||
109 | 5c387707 | semi | }; |
110 | |||
111 | SelectNavigationItem = NavigationItems.First(); |
||
112 | } |
||
113 | |||
114 | private void ListboxItemMouseUp() |
||
115 | { |
||
116 | var dependencyObject = Mouse.Captured as DependencyObject; |
||
117 | while (dependencyObject != null) |
||
118 | { |
||
119 | if (dependencyObject is ScrollBar) return; |
||
120 | dependencyObject = VisualTreeHelper.GetParent(dependencyObject); |
||
121 | } |
||
122 | |||
123 | IsMenuOpen = false; |
||
124 | } |
||
125 | |||
126 | #region Command |
||
127 | |||
128 | private ICommand _ListboxItemMouseUpCommand; |
||
129 | public ICommand ListboxItemMouseUpCommand |
||
130 | { |
||
131 | get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp())); |
||
132 | } |
||
133 | |||
134 | #endregion |
||
135 | |||
136 | } |
||
137 | } |