markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / MainViewModel.cs @ dfc86b71
이력 | 보기 | 이력해설 | 다운로드 (3.38 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 |
new MenuItem |
84 |
{ |
85 |
Name = "Process Alive Items", |
86 |
Description = "Convert Station Alive Items", |
87 |
Content = new Views.AliveView() |
88 |
}, |
89 |
|
90 |
//new MenuItem |
91 |
//{ |
92 |
// Name = "Convert Items", |
93 |
// Description = "Convert Items", |
94 |
// Content = new Views.MergeDataView() |
95 |
//}, |
96 |
new MenuItem |
97 |
{ |
98 |
Name = "Settings", |
99 |
Description = "Convert Station Settings", |
100 |
Content = new Views.SettingsView() |
101 |
} |
102 |
}; |
103 |
|
104 |
SelectNavigationItem = NavigationItems.First(); |
105 |
} |
106 |
|
107 |
private void ListboxItemMouseUp() |
108 |
{ |
109 |
var dependencyObject = Mouse.Captured as DependencyObject; |
110 |
while (dependencyObject != null) |
111 |
{ |
112 |
if (dependencyObject is ScrollBar) return; |
113 |
dependencyObject = VisualTreeHelper.GetParent(dependencyObject); |
114 |
} |
115 |
|
116 |
IsMenuOpen = false; |
117 |
} |
118 |
|
119 |
#region Command |
120 |
|
121 |
private ICommand _ListboxItemMouseUpCommand; |
122 |
public ICommand ListboxItemMouseUpCommand |
123 |
{ |
124 |
get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp())); |
125 |
} |
126 |
|
127 |
#endregion |
128 |
|
129 |
} |
130 |
} |