프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / MainViewModel.cs @ 67df8dcd

이력 | 보기 | 이력해설 | 다운로드 (3.38 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 0498c12e taeseongkim
                new MenuItem
84
                {
85 6f6e7dbf taeseongkim
                    Name = "Process Alive Items",
86 0498c12e taeseongkim
                    Description = "Convert Station Alive Items",
87
                    Content = new Views.AliveView()
88 6f6e7dbf taeseongkim
                },
89
90 2decfbdf alzkakdixm
                //new MenuItem
91
                //{
92
                //    Name = "Convert Items",
93
                //    Description = "Convert Items",
94
                //    Content = new Views.MergeDataView()
95
                //},
96 0498c12e taeseongkim
                  new MenuItem
97
                {
98
                    Name = "Settings",
99
                    Description = "Convert Station Settings",
100
                    Content = new Views.SettingsView()
101
                }
102 ed79bff0 taeseongkim
            };
103
104 566f0526 taeseongkim
            SelectNavigationItem = NavigationItems.First();
105 53c9637d taeseongkim
        }
106
107 0498c12e taeseongkim
        private void ListboxItemMouseUp()
108 6396f27e taeseongkim
        {
109 0498c12e taeseongkim
            var dependencyObject = Mouse.Captured as DependencyObject;
110
            while (dependencyObject != null)
111 6396f27e taeseongkim
            {
112 0498c12e taeseongkim
                if (dependencyObject is ScrollBar) return;
113
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
114 6396f27e taeseongkim
            }
115
116 0498c12e taeseongkim
            IsMenuOpen = false;
117 53c9637d taeseongkim
        }
118
119 0498c12e taeseongkim
        #region Command
120 6396f27e taeseongkim
121 0498c12e taeseongkim
        private ICommand _ListboxItemMouseUpCommand;
122
        public ICommand ListboxItemMouseUpCommand
123 53c9637d taeseongkim
        {
124 0498c12e taeseongkim
            get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp()));
125 53c9637d taeseongkim
        }
126
127 0498c12e taeseongkim
        #endregion
128
        
129 53c9637d taeseongkim
    }
130
}
클립보드 이미지 추가 (최대 크기: 500 MB)