1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
| using Panuon.WPF.UI;
| using System.Windows;
|
| namespace HMI.UI.Util
| {
| public interface ToastHandler
| {
| void Success(Window window,
| string message,
| MessageBoxIcon icon,
| ToastPosition position, double offset, int durationMs,
| ToastWindow targetWindow);
|
| void Warning(Window window,
| string message,
| MessageBoxIcon icon,
| ToastPosition position, double offset, int durationMs,
| ToastWindow targetWindow);
| }
|
| public class ToastHelper
| {
| private static ToastHandler Instance;
|
| public static void Register(ToastHandler helper)
| {
| if (Instance == null) { Instance = helper; }
| }
|
| public static void Success(Window window,
| string message,
| MessageBoxIcon icon = MessageBoxIcon.Success,
| ToastPosition position = ToastPosition.Top, double offset = 0, int durationMs = 3000,
| ToastWindow targetWindow = ToastWindow.ActiveWindow)
| {
| Instance.Success(window, message, icon, position, offset, durationMs, targetWindow);
| }
|
| public static void Warning(Window window,
| string message,
| MessageBoxIcon icon = MessageBoxIcon.Warning,
| ToastPosition position = ToastPosition.Top, double offset = 0, int durationMs = 3000,
| ToastWindow targetWindow = ToastWindow.ActiveWindow)
| {
| Instance.Warning(window, message, icon, position, offset, durationMs, targetWindow);
| }
| }
| }
|
|