프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (2.96 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.StationController.StationService;
15
using MaterialDesignExtensions.Model;
16

    
17
namespace Markus.Service.StationController.ViewModel
18
{
19
    public class MainViewModel : ViewModelBase
20
    {
21
        #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
        private bool isMenuOpen;
35

    
36
        public bool IsMenuOpen
37
        {
38
            get => isMenuOpen; set
39
            {
40
                isMenuOpen = value;
41
                OnPropertyChanged(() => IsMenuOpen);
42
            }
43
        }
44

    
45
        
46

    
47
        private List<MenuItem> navigationItems;
48

    
49
        public List<MenuItem> NavigationItems
50
        {
51
            get => navigationItems; set
52
            {
53
                navigationItems = value;
54
                OnPropertyChanged(() =>NavigationItems);
55
            }
56
        }
57

    
58
        private MenuItem selectNavigationItem;
59

    
60
        public MenuItem SelectNavigationItem
61
        {
62
            get => selectNavigationItem; set
63
            {
64
                selectNavigationItem = value;
65
                OnPropertyChanged(() => SelectNavigationItem);
66
            }
67
        }
68

    
69
        #endregion 프로퍼티
70

    
71
        public override void Loaded()
72
        {
73
            base.Loaded();
74

    
75
            NavigationItems = new List<MenuItem>
76
            {
77
                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
            };
90

    
91
            SelectNavigationItem = NavigationItems.First();
92
        }
93

    
94
        private void ListboxItemMouseUp()
95
        {
96
            var dependencyObject = Mouse.Captured as DependencyObject;
97
            while (dependencyObject != null)
98
            {
99
                if (dependencyObject is ScrollBar) return;
100
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
101
            }
102

    
103
            IsMenuOpen = false;
104
        }
105

    
106
        #region Command
107

    
108
        private ICommand _ListboxItemMouseUpCommand;
109
        public ICommand ListboxItemMouseUpCommand
110
        {
111
            get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp()));
112
        }
113

    
114
        #endregion
115
        
116
    }
117
}
클립보드 이미지 추가 (최대 크기: 500 MB)