프로젝트

일반

사용자정보

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

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

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