Dreamine.MVVM.Wpf
1.0.3
Dreamine.MVVM.Wpf 사용자 인터페이스 기능과 구성 요소를 제공합니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
WindowStateService.cs
이 파일의 문서화 페이지로 가기
1
using
Dreamine.MVVM.Interfaces.Windows;
2
using
System;
3
using
System.Collections.Concurrent;
4
5
namespace
Dreamine.MVVM.Wpf
6
{
23
public
sealed
class
WindowStateService
: IWindowStateService
24
{
33
private
readonly ConcurrentDictionary<string, bool>
_states
=
new
();
34
43
public
event
EventHandler<WindowStateChangedEventArgs>?
StateChanged
;
44
69
public
bool
IsOpen
(
string
windowKey)
70
{
71
ValidateWindowKey
(windowKey);
72
73
return
_states
.TryGetValue(windowKey, out
bool
isOpen) && isOpen;
74
}
75
92
public
void
MarkOpened
(
string
windowKey)
93
{
94
SetState
(windowKey,
true
);
95
}
96
113
public
void
MarkClosed
(
string
windowKey)
114
{
115
SetState
(windowKey,
false
);
116
}
117
142
private
void
SetState
(
string
windowKey,
bool
isOpen)
143
{
144
ValidateWindowKey
(windowKey);
145
146
_states
[windowKey] = isOpen;
147
StateChanged
?.Invoke(
this
,
new
WindowStateChangedEventArgs(windowKey, isOpen));
148
}
149
174
private
static
void
ValidateWindowKey
(
string
windowKey)
175
{
176
if
(
string
.IsNullOrWhiteSpace(windowKey))
177
{
178
throw
new
ArgumentException(
"Window key must not be empty."
, nameof(windowKey));
179
}
180
}
181
}
182
}
Dreamine.MVVM.Wpf
Definition
DreamineAppBuilder.cs:13
Dreamine.MVVM.Wpf.WindowStateService
Definition
WindowStateService.cs:24
Dreamine.MVVM.Wpf.WindowStateService.MarkOpened
void MarkOpened(string windowKey)
Definition
WindowStateService.cs:92
Dreamine.MVVM.Wpf.WindowStateService.MarkClosed
void MarkClosed(string windowKey)
Definition
WindowStateService.cs:113
Dreamine.MVVM.Wpf.WindowStateService.StateChanged
EventHandler< WindowStateChangedEventArgs >? StateChanged
Definition
WindowStateService.cs:43
Dreamine.MVVM.Wpf.WindowStateService.ValidateWindowKey
static void ValidateWindowKey(string windowKey)
Definition
WindowStateService.cs:174
Dreamine.MVVM.Wpf.WindowStateService.IsOpen
bool IsOpen(string windowKey)
Definition
WindowStateService.cs:69
Dreamine.MVVM.Wpf.WindowStateService._states
readonly ConcurrentDictionary< string, bool > _states
Definition
WindowStateService.cs:33
Dreamine.MVVM.Wpf.WindowStateService.SetState
void SetState(string windowKey, bool isOpen)
Definition
WindowStateService.cs:142
WindowStateService.cs
다음에 의해 생성됨 :
1.17.0