프로젝트

일반

사용자정보

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

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

이력 | 보기 | 이력해설 | 다운로드 (3.14 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
                new MenuItem
77
                {
78
                    Name = "Process Alive Items",
79
                    Description = "Convert Station Alive Items",
80
                    Content = new Views.AliveView()
81
                },
82

    
83
                new MenuItem
84
                {
85
                    Name = "Convert Items",
86
                    Description = "Convert Items",
87
                    Content = new Views.MergeDataView()
88
                },
89
                  new MenuItem
90
                {
91
                    Name = "Settings",
92
                    Description = "Convert Station Settings",
93
                    Content = new Views.SettingsView()
94
                }
95
            };
96

    
97
            SelectNavigationItem = NavigationItems.First();
98
        }
99

    
100
        private void ListboxItemMouseUp()
101
        {
102
            var dependencyObject = Mouse.Captured as DependencyObject;
103
            while (dependencyObject != null)
104
            {
105
                if (dependencyObject is ScrollBar) return;
106
                dependencyObject = VisualTreeHelper.GetParent(dependencyObject);
107
            }
108

    
109
            IsMenuOpen = false;
110
        }
111

    
112
        #region Command
113

    
114
        private ICommand _ListboxItemMouseUpCommand;
115
        public ICommand ListboxItemMouseUpCommand
116
        {
117
            get => _ListboxItemMouseUpCommand ?? (_ListboxItemMouseUpCommand = new RelayCommand(param => ListboxItemMouseUp()));
118
        }
119

    
120
        #endregion
121
        
122
    }
123
}
클립보드 이미지 추가 (최대 크기: 500 MB)