프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (2.96 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 53c9637d taeseongkim
using Markus.Service.StationController.StationService;
15 ed79bff0 taeseongkim
using MaterialDesignExtensions.Model;
16 53c9637d taeseongkim
17
namespace Markus.Service.StationController.ViewModel
18
{
19 45f9a2ad taeseongkim
    public class MainViewModel : ViewModelBase
20 53c9637d taeseongkim
    {
21 45f9a2ad taeseongkim
        #region 프로퍼티
22
23
        private string id;
24
25
        public string Id
26
        {
27
            get => id; set
28
            {
29
                id = value;
30
                OnPropertyChanged(() => Id);
31
            }
32
        }
33
34 0498c12e taeseongkim
        private bool isMenuOpen;
35 45f9a2ad taeseongkim
36 0498c12e taeseongkim
        public bool IsMenuOpen
37 45f9a2ad taeseongkim
        {
38 0498c12e taeseongkim
            get => isMenuOpen; set
39 45f9a2ad taeseongkim
            {
40 0498c12e taeseongkim
                isMenuOpen = value;
41
                OnPropertyChanged(() => IsMenuOpen);
42 45f9a2ad taeseongkim
            }
43
        }
44
45 0498c12e taeseongkim
        
46 45f9a2ad taeseongkim
47 0498c12e taeseongkim
        private List<MenuItem> navigationItems;
48
49
        public List<MenuItem> NavigationItems
50 45f9a2ad taeseongkim
        {
51
            get => navigationItems; set
52
            {
53
                navigationItems = value;
54 0157b158 taeseongkim
                OnPropertyChanged(() =>NavigationItems);
55 45f9a2ad taeseongkim
            }
56
        }
57
58 0498c12e taeseongkim
        private MenuItem selectNavigationItem;
59 45f9a2ad taeseongkim
60 0498c12e taeseongkim
        public MenuItem SelectNavigationItem
61 45f9a2ad taeseongkim
        {
62
            get => selectNavigationItem; set
63
            {
64
                selectNavigationItem = value;
65
                OnPropertyChanged(() => SelectNavigationItem);
66
            }
67
        }
68
69
        #endregion 프로퍼티
70
71 0498c12e taeseongkim
        public override void Loaded()
72 53c9637d taeseongkim
        {
73 0498c12e taeseongkim
            base.Loaded();
74 ed79bff0 taeseongkim
75 0498c12e taeseongkim
            NavigationItems = new List<MenuItem>
76 ed79bff0 taeseongkim
            {
77 0498c12e taeseongkim
                new MenuItem
78
                {
79
                    Name = "Alive Items",
80
                    Description = "Convert Station Alive Items",
81
                    Content = new Views.AliveView()
82
                },
83
                  new MenuItem
84
                {
85
                    Name = "Settings",
86
                    Description = "Convert Station Settings",
87
                    Content = new Views.SettingsView()
88
                }
89 ed79bff0 taeseongkim
            };
90
91 566f0526 taeseongkim
            SelectNavigationItem = NavigationItems.First();
92 53c9637d taeseongkim
        }
93
94 0498c12e taeseongkim
        private void ListboxItemMouseUp()
95 6396f27e taeseongkim
        {
96 0498c12e taeseongkim
            var dependencyObject = Mouse.Captured as DependencyObject;
97
            while (dependencyObject != null)
98 6396f27e taeseongkim
            {
99 0498c12e taeseongkim
                if (dependencyObject is ScrollBar) return;
100
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
101 6396f27e taeseongkim
            }
102
103 0498c12e taeseongkim
            IsMenuOpen = false;
104 53c9637d taeseongkim
        }
105
106 0498c12e taeseongkim
        #region Command
107 6396f27e taeseongkim
108 0498c12e taeseongkim
        private ICommand _ListboxItemMouseUpCommand;
109
        public ICommand ListboxItemMouseUpCommand
110 53c9637d taeseongkim
        {
111 0498c12e taeseongkim
            get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp()));
112 53c9637d taeseongkim
        }
113
114 0498c12e taeseongkim
        #endregion
115
        
116 53c9637d taeseongkim
    }
117
}
클립보드 이미지 추가 (최대 크기: 500 MB)