SampleCore 1.0.0.0
SampleCore 사용 방법을 보여 주는 예제 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
MainWindowEvent.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.MVVM.Interfaces.Navigation;
3using System.Windows;
4
6{
15 public class MainWindowEvent
16 {
25 private readonly IViewManager _viewManager;
42 public MainWindowEvent(IViewManager viewManager) => _viewManager = viewManager;
43
52 public void Ok() => MessageBox.Show("확인 클릭됨!");
61 public void Cancel() => MessageBox.Show("취소 클릭됨!");
62
71 public void SubPage() => _viewManager.Show<PageSubViewModel>();
72
81 public void Minimize()
82 {
83 var w = GetActiveWindow();
84 if (w != null) w.WindowState = WindowState.Minimized;
85 }
86
95 public void Maximize()
96 {
97 var w = GetActiveWindow();
98 if (w != null)
99 {
100 w.WindowState = w.WindowState == WindowState.Maximized
101 ? WindowState.Normal
102 : WindowState.Maximized;
103 }
104 }
105
114 public void Close()
115 {
116 GetActiveWindow()?.Close();
117 }
118
135 private Window? GetActiveWindow()
136 {
137 return Application.Current?.Windows.OfType<Window>().FirstOrDefault(w => w.IsActive);
138 }
139 }
140}
readonly IViewManager _viewManager
MainWindowEvent(IViewManager viewManager)