@@ -45,23 +45,13 @@ public void Show(string? text, MessageBoxStatus status = MessageBoxStatus.Error,
45
45
46
46
var templateFile = MessageBoxTemplatesPath ;
47
47
48
- switch ( status )
48
+ templateFile += status switch
49
49
{
50
- case MessageBoxStatus . Information :
51
- templateFile += "InfoMessageBox.tpl" ;
52
- break ;
53
-
54
- case MessageBoxStatus . Error :
55
- templateFile += "ErrorMessageBox.tpl" ;
56
- break ;
57
-
58
- case MessageBoxStatus . Ok :
59
- templateFile += "OkMessageBox.tpl" ;
60
- break ;
61
-
62
- default :
63
- throw new ArgumentOutOfRangeException ( nameof ( status ) , status , null ) ;
64
- }
50
+ MessageBoxStatus . Information => "InfoMessageBox.tpl" ,
51
+ MessageBoxStatus . Error => "ErrorMessageBox.tpl" ,
52
+ MessageBoxStatus . Ok => "OkMessageBox.tpl" ,
53
+ _ => throw new ArgumentOutOfRangeException ( nameof ( status ) , status , null )
54
+ } ;
65
55
66
56
var tpl = templateFactory . Load ( templateFile ) ;
67
57
@@ -94,23 +84,13 @@ public string GetInline(string? text, MessageBoxStatus status = MessageBoxStatus
94
84
95
85
var templateFile = MessageBoxTemplatesPath ;
96
86
97
- switch ( status )
87
+ templateFile += status switch
98
88
{
99
- case MessageBoxStatus . Information :
100
- templateFile += "InlineInfoMessageBox.tpl" ;
101
- break ;
102
-
103
- case MessageBoxStatus . Error :
104
- templateFile += "InlineErrorMessageBox.tpl" ;
105
- break ;
106
-
107
- case MessageBoxStatus . Ok :
108
- templateFile += "InlineOkMessageBox.tpl" ;
109
- break ;
110
-
111
- default :
112
- throw new ArgumentOutOfRangeException ( nameof ( status ) , status , null ) ;
113
- }
89
+ MessageBoxStatus . Information => "InlineInfoMessageBox.tpl" ,
90
+ MessageBoxStatus . Error => "InlineErrorMessageBox.tpl" ,
91
+ MessageBoxStatus . Ok => "InlineOkMessageBox.tpl" ,
92
+ _ => throw new ArgumentOutOfRangeException ( nameof ( status ) , status , null )
93
+ } ;
114
94
115
95
var tpl = templateFactory . Load ( templateFile ) ;
116
96
0 commit comments