markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / MainViewModel.cs @ 9b2f01e1
이력 | 보기 | 이력해설 | 다운로드 (3.13 KB)
1 |
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 |
NavigationItems = new List<MenuItem> |
75 |
{ |
76 |
|
77 |
new MenuItem |
78 |
{ |
79 |
Name = "DataBase Items", |
80 |
Description = "DataBase Items", |
81 |
Content = new Views.DataBaseView() |
82 |
}, |
83 |
|
84 |
new MenuItem |
85 |
{ |
86 |
Name = "FinalPDF Items", |
87 |
Description = "FinalPDF Items", |
88 |
Content = new Views.FinalPDFView() |
89 |
}, |
90 |
|
91 |
new MenuItem |
92 |
{ |
93 |
Name = "Dash Board", |
94 |
Description = "Dash Board", |
95 |
Content = new Views.DashBoard() |
96 |
}, |
97 |
|
98 |
}; |
99 |
|
100 |
SelectNavigationItem = NavigationItems.First(); |
101 |
} |
102 |
|
103 |
private void ListboxItemMouseUp() |
104 |
{ |
105 |
var dependencyObject = Mouse.Captured as DependencyObject; |
106 |
while (dependencyObject != null) |
107 |
{ |
108 |
if (dependencyObject is ScrollBar) return; |
109 |
dependencyObject = VisualTreeHelper.GetParent(dependencyObject); |
110 |
} |
111 |
|
112 |
IsMenuOpen = false; |
113 |
} |
114 |
|
115 |
#region Command |
116 |
|
117 |
private ICommand _ListboxItemMouseUpCommand; |
118 |
public ICommand ListboxItemMouseUpCommand |
119 |
{ |
120 |
get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp())); |
121 |
} |
122 |
|
123 |
#endregion |
124 |
|
125 |
} |
126 |
} |