Dreamine.UI.Abstractions 1.0.1
Dreamine.UI.Abstractions 공용 계약과 추상화를 제공합니다.
로딩중...
검색중...
일치하는것 없음
EnterActionResult.cs
이 파일의 문서화 페이지로 가기
1using System.Windows;
2using System.Windows.Controls;
3using System.Windows.Media;
4
6
16{
25 public ActionResult Result { get; set; }
34 public string Message { get; set; } = string.Empty;
43 public Action? Action { get; set; }
44
61 public EnterActionResult(ActionResult result) => Result = result;
62
87 public EnterActionResult(ActionResult result, string message) : this(result)
88 {
89 Message = message;
90 }
91
108 public bool IsAccepted() => Result is ActionResult.OK or ActionResult.DoNothing;
109
134 public void Show(TextBox textBox)
135 {
136#pragma warning disable CS1587 // Doxygen documents local functions; the C# compiler does not attach XML docs to them.
147 void Apply()
148 {
149 textBox.Text = Message;
150 textBox.Foreground = Result == ActionResult.OK ? Brushes.Black : Brushes.Red;
151 }
152#pragma warning restore CS1587
153
154 var dispatcher = Application.Current.Dispatcher;
155 if (dispatcher.CheckAccess())
156 Apply();
157 else
158 dispatcher.BeginInvoke(Apply);
159 }
160}
161
171{
188 public OkEnterActionResult(string message = "") : base(ActionResult.OK, message) { }
189}
190
200{
217 public NgEnterActionResult(string message = "") : base(ActionResult.NG, message) { }
218}
219