SampleEnterprise.Events 1.0.0.0
SampleEnterprise.Events 사용 방법을 보여 주는 예제 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
MainWindowEvent.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.MVVM.Interfaces.Navigation;
2using System.Windows;
3using Dreamine.MVVM.Core;
4
6{
15 public class MainWindowEvent
16 {
25 private readonly IViewManager _viewManager;
35 {
36 _viewManager = DMContainer.Resolve<IViewManager>();
37 }
38
47 public void Ok() => MessageBox.Show("확인 클릭됨!");
56 public void Cancel() => MessageBox.Show("취소 클릭됨!");
57
66 public void SubPage()
67 {
68 var vmType = Type.GetType("SampleEnterprise.ViewModels.PageSub.PageSubViewModel, SampleEnterprise.ViewModels");
69 if (vmType != null)
70 _viewManager.Show(vmType);
71 }
72
73
82 public void Minimize()
83 {
84 var w = GetActiveWindow();
85 if (w != null) w.WindowState = WindowState.Minimized;
86 }
87
96 public void Maximize()
97 {
98 var w = GetActiveWindow();
99 if (w != null)
100 {
101 w.WindowState = w.WindowState == WindowState.Maximized
102 ? WindowState.Normal
103 : WindowState.Maximized;
104 }
105 }
106
115 public void Close()
116 {
117 GetActiveWindow()?.Close();
118 }
119
136 private static Window? GetActiveWindow()
137 {
138 return Application.Current?.Windows
139 .OfType<Window>()
140 .FirstOrDefault(w => w.IsActive);
141 }
142 }
143}