Skip to content

Commit 17ccf89

Browse files
committed
[fix] analyzer warnings and XML comments
1 parent 470687a commit 17ccf89

File tree

5 files changed

+30
-33
lines changed

5 files changed

+30
-33
lines changed

src/Simplify.Web.MessageBox/IMessageBoxHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Simplify.Web.MessageBox;
44

55
/// <summary>
6-
/// The HTML message box
6+
/// Represents am HTML message box.
77
/// Usable template files:
88
/// "Simplify.Web/MessageBox/InfoMessageBox.tpl"
99
/// "Simplify.Web/MessageBox/ErrorMessageBox.tpl"

src/Simplify.Web.MessageBox/MessageBoxHandler.cs

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,34 @@
44
namespace Simplify.Web.MessageBox;
55

66
/// <summary>
7-
/// The HTML message box
7+
/// Provides the HTML message box.
88
/// Usable template files:
99
/// "Simplify.Web/MessageBox/InfoMessageBox.tpl"
1010
/// "Simplify.Web/MessageBox/ErrorMessageBox.tpl"
1111
/// "Simplify.Web/MessageBox/OkMessageBox.tpl"
1212
/// "Simplify.Web/MessageBox/InlineInfoMessageBox.tpl"
1313
/// "Simplify.Web/MessageBox/InlineErrorMessageBox.tpl"
1414
/// "Simplify.Web/MessageBox/InlineOkMessageBox.tpl"
15-
/// Usable <see cref="StringTable"/> items:
15+
/// Usable <see cref="StringTable" /> items:
1616
/// "FormTitleMessageBox"
1717
/// Template variables:
1818
/// "Message"
1919
/// "Title"
2020
/// </summary>
21-
public sealed class MessageBoxHandler : IMessageBoxHandler
21+
/// <seealso cref="IMessageBoxHandler" />
22+
/// <remarks>
23+
/// Initializes a new instance of the <see cref="MessageBoxHandler" /> class.
24+
/// </remarks>
25+
/// <param name="templateFactory">The template factory.</param>
26+
/// <param name="stringTable">The string table.</param>
27+
/// <param name="dataCollector">The data collector.</param>
28+
public sealed class MessageBoxHandler(ITemplateFactory templateFactory, IStringTable stringTable, IDataCollector dataCollector) : IMessageBoxHandler
2229
{
2330
/// <summary>
2431
/// The message box templates path
2532
/// </summary>
2633
public const string MessageBoxTemplatesPath = "App_Packages/Simplify.Web.MessageBox/";
2734

28-
private readonly ITemplateFactory _templateFactory;
29-
private readonly IStringTable _stringTable;
30-
private readonly IDataCollector _dataCollector;
31-
32-
/// <summary>
33-
/// Initializes a new instance of the <see cref="MessageBoxHandler"/> class.
34-
/// </summary>
35-
/// <param name="templateFactory">The template factory.</param>
36-
/// <param name="stringTable">The string table.</param>
37-
/// <param name="dataCollector">The data collector.</param>
38-
public MessageBoxHandler(ITemplateFactory templateFactory, IStringTable stringTable, IDataCollector dataCollector)
39-
{
40-
_templateFactory = templateFactory;
41-
_stringTable = stringTable;
42-
_dataCollector = dataCollector;
43-
}
44-
4535
/// <summary>
4636
/// Generate message box HTML and set to data collector
4737
/// </summary>
@@ -68,15 +58,18 @@ public void Show(string? text, MessageBoxStatus status = MessageBoxStatus.Error,
6858
case MessageBoxStatus.Ok:
6959
templateFile += "OkMessageBox.tpl";
7060
break;
61+
62+
default:
63+
throw new ArgumentOutOfRangeException(nameof(status), status, null);
7164
}
7265

73-
var tpl = _templateFactory.Load(templateFile);
66+
var tpl = templateFactory.Load(templateFile);
7467

7568
tpl.Set("Message", text);
76-
tpl.Set("Title", string.IsNullOrEmpty(title) ? _stringTable.GetItem("FormTitleMessageBox") : title);
69+
tpl.Set("Title", string.IsNullOrEmpty(title) ? stringTable.GetItem("FormTitleMessageBox") : title);
7770

78-
_dataCollector.Add(tpl.Get());
79-
_dataCollector.AddTitle(string.IsNullOrEmpty(title) ? _stringTable.GetItem("FormTitleMessageBox") : title);
71+
dataCollector.Add(tpl.Get());
72+
dataCollector.AddTitle(string.IsNullOrEmpty(title) ? stringTable.GetItem("FormTitleMessageBox") : title);
8073
}
8174

8275
/// <summary>
@@ -86,7 +79,7 @@ public void Show(string? text, MessageBoxStatus status = MessageBoxStatus.Error,
8679
/// <param name="status">Status of a message box</param>
8780
/// <param name="title">Title of a message box</param>
8881
public void ShowSt(string stringTableItemName, MessageBoxStatus status = MessageBoxStatus.Error, string? title = null) =>
89-
Show(_stringTable.GetItem(stringTableItemName), status, title);
82+
Show(stringTable.GetItem(stringTableItemName), status, title);
9083

9184
/// <summary>
9285
/// Get inline message box HTML
@@ -114,9 +107,12 @@ public string GetInline(string? text, MessageBoxStatus status = MessageBoxStatus
114107
case MessageBoxStatus.Ok:
115108
templateFile += "InlineOkMessageBox.tpl";
116109
break;
110+
111+
default:
112+
throw new ArgumentOutOfRangeException(nameof(status), status, null);
117113
}
118114

119-
var tpl = _templateFactory.Load(templateFile);
115+
var tpl = templateFactory.Load(templateFile);
120116

121117
tpl.Set("Message", text);
122118

@@ -130,5 +126,5 @@ public string GetInline(string? text, MessageBoxStatus status = MessageBoxStatus
130126
/// <param name="status">Status of a message box</param>
131127
/// <returns>Message box html</returns>
132128
public string GetInlineSt(string stringTableItemName, MessageBoxStatus status = MessageBoxStatus.Error) =>
133-
GetInline(_stringTable.GetItem(stringTableItemName), status);
129+
GetInline(stringTable.GetItem(stringTableItemName), status);
134130
}

src/Simplify.Web.MessageBox/MessageBoxStatus.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace Simplify.Web.MessageBox;
22

33
/// <summary>
4-
/// MessageBox status
4+
/// Provides the MessageBox status.
55
/// </summary>
66
public enum MessageBoxStatus
77
{

src/Simplify.Web.MessageBox/Responses/MessageBox.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace Simplify.Web.MessageBox.Responses;
44

55
/// <summary>
6-
/// Provides message box response (generate message box and puts it to the data collector)
6+
/// Provides message box response (generate message box and puts it to the data collector).
77
/// </summary>
8+
/// <seealso cref="ControllerResponse" />
89
public class MessageBox : ControllerResponse
910
{
1011
/// <summary>

src/Simplify.Web.MessageBox/Responses/MessageBoxInline.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
namespace Simplify.Web.MessageBox.Responses;
44

55
/// <summary>
6-
/// Provides inline message box response (generate inline message box and sends it to the user only, without site generation)
6+
/// Provides inline message box response (generate inline message box and sends it to the user only, without site generation).
77
/// </summary>
8+
/// <seealso cref="ControllerResponse" />
89
/// <remarks>
9-
/// Initializes a new instance of the <see cref="Web.MessageBox.Responses.MessageBox"/> class.
10+
/// Initializes a new instance of the <see cref="Web.MessageBox.Responses.MessageBox" /> class.
1011
/// </remarks>
1112
/// <param name="text">The message box text.</param>
1213
/// <param name="status">The message box status.</param>
1314
public class MessageBoxInline(string text, MessageBoxStatus status = MessageBoxStatus.Error) : ControllerResponse
1415
{
15-
1616
/// <summary>
1717
/// Gets the text.
1818
/// </summary>

0 commit comments

Comments
 (0)