Skip to content

Commit 82c73da

Browse files
committed
Mostly XML documentation
1 parent ca0383f commit 82c73da

File tree

9 files changed

+116
-13
lines changed

9 files changed

+116
-13
lines changed

src/Skybrud.Umbraco.MultiNodeTreePicker/Composers/MntpConverterCollection.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55

66
namespace Skybrud.Umbraco.MultiNodeTreePicker.Composers {
77

8+
/// <summary>
9+
/// Class representing a collection of <see cref="IMntpItemConverter"/>.
10+
/// </summary>
811
public sealed class MntpConverterCollection : BuilderCollectionBase<IMntpItemConverter> {
912

1013
private readonly Dictionary<string, IMntpItemConverter> _lookup;
1114

12-
public MntpConverterCollection(Func<IEnumerable<IMntpItemConverter>> items) : base(items) {
15+
/// <summary>
16+
/// Initializes an new instance based on the specified <paramref name="converters"/>.
17+
/// </summary>
18+
/// <param name="converters">The item converters that should make up the collection.</param>
19+
public MntpConverterCollection(Func<IEnumerable<IMntpItemConverter>> converters) : base(converters) {
1320

1421
_lookup = new Dictionary<string, IMntpItemConverter>(StringComparer.OrdinalIgnoreCase);
1522

@@ -24,8 +31,17 @@ public MntpConverterCollection(Func<IEnumerable<IMntpItemConverter>> items) : ba
2431

2532
}
2633

27-
public bool TryGet(string typeName, out IMntpItemConverter item) {
28-
return _lookup.TryGetValue(typeName, out item);
34+
/// <summary>
35+
/// Gets the item converter associated with the specified <paramref name="typeName"/>.
36+
/// </summary>
37+
/// <param name="typeName">The name of the type.</param>
38+
/// <param name="result">When this method returns, contains the item converter associated with the specified
39+
/// <paramref name="typeName"/>, if the key is found; otherwise <c>null</c>. This parameter is passed
40+
/// uninitialized.</param>
41+
/// <returns><c>true</c> if the collection contains an item converter with the specified
42+
/// <paramref name="typeName"/>; otherwise, false.</returns>
43+
public bool TryGet(string typeName, out IMntpItemConverter result) {
44+
return _lookup.TryGetValue(typeName, out result);
2945
}
3046

3147
}

src/Skybrud.Umbraco.MultiNodeTreePicker/Controllers/MntpController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using Umbraco.Cms.Web.BackOffice.Controllers;
44
using Umbraco.Cms.Web.Common.Attributes;
55

6+
#pragma warning disable 1591
7+
68
namespace Skybrud.Umbraco.MultiNodeTreePicker.Controllers {
79

810
[PluginController("Skybrud")]

src/Skybrud.Umbraco.MultiNodeTreePicker/Converters/IMntpItemConverter.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,30 @@
44

55
namespace Skybrud.Umbraco.MultiNodeTreePicker.Converters {
66

7+
/// <summary>
8+
/// Interface describing an item converter.
9+
/// </summary>
710
public interface IMntpItemConverter {
811

12+
/// <summary>
13+
/// Gets the friendly name of the item converter.
14+
/// </summary>
915
[JsonProperty("name")]
1016
string Name { get; }
1117

18+
/// <summary>
19+
/// Returns the converted item based on <paramref name="source"/>.
20+
/// </summary>
21+
/// <param name="propertyType">The property type.</param>
22+
/// <param name="source">The source <see cref="IPublishedContent"/>.</param>
23+
/// <returns>The converted item.</returns>
1224
object Convert(IPublishedPropertyType propertyType, IPublishedContent source);
1325

26+
/// <summary>
27+
/// Returns the <see cref="Type"/> of the items returned by this item converter.
28+
/// </summary>
29+
/// <param name="propertyType">The property type.</param>
30+
/// <returns>The <see cref="Type"/> of the items returned by this item converter.</returns>
1431
Type GetType(IPublishedPropertyType propertyType);
1532

1633
}

src/Skybrud.Umbraco.MultiNodeTreePicker/Converters/MntpGenericItemConverter.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,49 @@
33

44
namespace Skybrud.Umbraco.MultiNodeTreePicker.Converters {
55

6+
/// <summary>
7+
/// Generic item converter implementing the <see cref="IMntpItemConverter"/>.
8+
///
9+
/// The item converter works by specifying a callback method which then will be used for converting the items.
10+
/// </summary>
11+
/// <typeparam name="T">The type of the items.</typeparam>
612
public abstract class MntpGenericItemConverter<T> : IMntpItemConverter {
7-
13+
14+
/// <summary>
15+
/// Gets the friendly name of the item converter.
16+
/// </summary>
817
public string Name { get; }
918

19+
/// <summary>
20+
/// Gets a reference to the callback function used for converting the items.
21+
/// </summary>
1022
protected Func<IPublishedContent, T> Callback { get; }
1123

24+
/// <summary>
25+
/// Initializes a new instance based on the specified <paramref name="name"/> and <paramref name="callback"/>.
26+
/// </summary>
27+
/// <param name="name">The friendly name of the item converter.</param>
28+
/// <param name="callback">The callback function used for converting the items.</param>
1229
protected MntpGenericItemConverter(string name, Func<IPublishedContent, T> callback) {
1330
Name = name;
1431
Callback = callback;
1532
}
16-
33+
34+
/// <summary>
35+
/// Returns the converted item based on <paramref name="source"/>.
36+
/// </summary>
37+
/// <param name="propertyType">The property type.</param>
38+
/// <param name="source">The source <see cref="IPublishedContent"/>.</param>
39+
/// <returns>The converted item.</returns>
1740
public virtual object Convert(IPublishedPropertyType propertyType, IPublishedContent source) {
1841
return source is null ? null : Callback(source);
1942
}
20-
43+
44+
/// <summary>
45+
/// Returns the <see cref="Type"/> of the items returned by this item converter.
46+
/// </summary>
47+
/// <param name="propertyType">The property type.</param>
48+
/// <returns>The <see cref="Type"/> of the items returned by this item converter.</returns>
2149
public virtual Type GetType(IPublishedPropertyType propertyType) {
2250
return typeof(T);
2351
}

src/Skybrud.Umbraco.MultiNodeTreePicker/Converters/MntpItemConverterBase.cs

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,38 @@
33

44
namespace Skybrud.Umbraco.MultiNodeTreePicker.Converters {
55

6+
/// <summary>
7+
/// Generic item converter base implementing the <see cref="IMntpItemConverter"/>.
8+
/// </summary>
9+
/// <typeparam name="T">The type of the items.</typeparam>
610
public abstract class MntpItemConverterBase<T> : IMntpItemConverter {
7-
11+
12+
/// <summary>
13+
/// Gets the friendly name of the item converter.
14+
/// </summary>
815
public string Name { get; }
9-
16+
17+
/// <summary>
18+
/// Initializes a new instance based on the specified <paramref name="name"/>.
19+
/// </summary>
20+
/// <param name="name">The friendly name of the item converter.</param>
1021
protected MntpItemConverterBase(string name) {
1122
Name = name;
1223
}
13-
24+
25+
/// <summary>
26+
/// Returns the converted item based on <paramref name="source"/>.
27+
/// </summary>
28+
/// <param name="propertyType">The property type.</param>
29+
/// <param name="source">The source <see cref="IPublishedContent"/>.</param>
30+
/// <returns>The converted item.</returns>
1431
public abstract object Convert(IPublishedPropertyType propertyType, IPublishedContent source);
15-
32+
33+
/// <summary>
34+
/// Returns the <see cref="Type"/> of the items returned by this item converter.
35+
/// </summary>
36+
/// <param name="propertyType">The property type.</param>
37+
/// <returns>The <see cref="Type"/> of the items returned by this item converter.</returns>
1638
public virtual Type GetType(IPublishedPropertyType propertyType) {
1739
return typeof(T);
1840
}

src/Skybrud.Umbraco.MultiNodeTreePicker/PropertyEditors/MntpConfiguration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33

44
namespace Skybrud.Umbraco.MultiNodeTreePicker.PropertyEditors {
55

6+
/// <summary>
7+
/// Class representing the configuration of a <see cref="MntpEditor"/> data type.
8+
/// </summary>
69
public class MntpConfiguration : MultiNodePickerConfiguration {
710

11+
/// <summary>
12+
/// Gets or sets an instance of <see cref="JObject"/> representing the information about the selected item converter.
13+
/// </summary>
814
[ConfigurationField("itemConverter", "Item converter", "/App_Plugins/Skybrud.Umbraco.MultiNodeTreePicker/MntpConverter.html", Description = "Select an item converter.")]
915
public JObject ItemConverter { get; set; }
1016

src/Skybrud.Umbraco.MultiNodeTreePicker/PropertyEditors/MntpConfigurationEditor.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
using Umbraco.Cms.Core.IO;
33
using Umbraco.Cms.Core.PropertyEditors;
44

5+
#pragma warning disable 1591
6+
57
namespace Skybrud.Umbraco.MultiNodeTreePicker.PropertyEditors {
68

79
public class MntpConfigurationEditor : ConfigurationEditor<MntpConfiguration> {

src/Skybrud.Umbraco.MultiNodeTreePicker/PropertyEditors/MntpEditor.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
using Umbraco.Cms.Core.IO;
22
using Umbraco.Cms.Core.PropertyEditors;
33

4+
#pragma warning disable 1591
5+
46
namespace Skybrud.Umbraco.MultiNodeTreePicker.PropertyEditors {
57

68
[DataEditor(EditorAlias, "Skybrud Multinode Treepicker", EditorView, ValueType = ValueTypes.Text, Group = "Skybrud.dk", Icon = "icon-page-add color-skybrud")]
79
public class MntpEditor : MultiNodeTreePickerPropertyEditor {
810

9-
internal const string EditorAlias = "Skybrud.Umbraco.MultiNodeTreePicker";
11+
/// <summary>
12+
/// Gets the alias of the property editor.
13+
/// </summary>
14+
public const string EditorAlias = "Skybrud.Umbraco.MultiNodeTreePicker";
1015

11-
internal const string EditorView = "contentpicker";
16+
/// <summary>
17+
/// Gets the view of the property editor.
18+
/// </summary>
19+
public const string EditorView = "contentpicker";
1220

1321
private readonly IIOHelper _iOHelper;
1422

1523
public MntpEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper iOHelper) : base(dataValueEditorFactory, iOHelper) {
16-
this._iOHelper = iOHelper;
24+
_iOHelper = iOHelper;
1725
}
1826

1927
protected override IConfigurationEditor CreateConfigurationEditor() {

src/Skybrud.Umbraco.MultiNodeTreePicker/PropertyEditors/ValueConverters/MntpValueConverter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
using Umbraco.Cms.Core.Services;
1515
using Umbraco.Cms.Core.Web;
1616

17+
#pragma warning disable 1591
18+
1719
namespace Skybrud.Umbraco.MultiNodeTreePicker.PropertyEditors.ValueConverters {
1820

1921
public class MntpValueConverter : MultiNodeTreePickerValueConverter {

0 commit comments

Comments
 (0)