프로젝트

일반

사용자정보

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

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

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