@@ -45,23 +45,13 @@ public void Show(string? text, MessageBoxStatus status = MessageBoxStatus.Error,
4545
4646 var templateFile = MessageBoxTemplatesPath ;
4747
48- switch ( status )
48+ templateFile += status switch
4949 {
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+ } ;
6555
6656 var tpl = templateFactory . Load ( templateFile ) ;
6757
@@ -94,23 +84,13 @@ public string GetInline(string? text, MessageBoxStatus status = MessageBoxStatus
9484
9585 var templateFile = MessageBoxTemplatesPath ;
9686
97- switch ( status )
87+ templateFile += status switch
9888 {
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+ } ;
11494
11595 var tpl = templateFactory . Load ( templateFile ) ;
11696
0 commit comments