Repository navigation
Expand file tree
/
Copy pathComplexAppliedManager.cs
More file actions
103 lines (94 loc) · 3.21 KB
/
Copy pathComplexAppliedManager.cs
File metadata and controls
103 lines (94 loc) · 3.21 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using System;
using System.Linq;
namespace Process.NET.Applied
{
/// <summary>
/// Class ComplexAppliedManager.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <seealso cref="T:Process.NET.Applied.AppliedManager`1" />
/// <seealso cref="T:Process.NET.Applied.IComplexAppliedManager`1" />
public abstract class ComplexAppliedManager<T> : AppliedManager<T>, IComplexAppliedManager<T>
where T : IComplexApplied
{
/// <summary>
/// Disables <see langword="this" /> instance.
/// </summary>
/// <param name="detour">The item.</param>
/// <param name="dueToRules">
/// if set to <c><see langword="true"</c> [due to rules].
/// </param>
public abstract void Disable(T detour, bool dueToRules);
/// <summary>
/// Disables <see langword="this" /> instance.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="dueToRules">
/// if set to <c><see langword="true"</c> [due to rules].
/// </param>
public abstract void Disable(string name, bool dueToRules);
/// <summary>
/// Disables all.
/// </summary>
/// <param name="dueToRules">
/// if set to <c>true</c> [due to rules].
/// </param>
public void DisableAll(bool dueToRules)
{
foreach (var value in InternalItems.Values.Where(applied => applied.IsEnabled))
{
Disable(value, dueToRules);
}
}
/// <summary>
/// Enables <see langword="this" /> instance.
/// </summary>
/// <param name="item">The <paramref name="item" /> .</param>
/// <param name="dueToRules">
/// if set to <c><see langword="true"</c> [due to rules].
/// </param>
public void Enable(T item, bool dueToRules)
{
if (item == null)
{
throw new ArgumentNullException(nameof(item));
}
if (item.IsEnabled)
{
return;
}
item.Enable(dueToRules);
}
/// <summary>
/// Enables <see langword="this" /> instance.
/// </summary>
/// <param name="name">The <paramref name="name" /> .</param>
/// <param name="dueToRules">
/// if set to <c><see langword="true"</c> [due to rules].
/// </param>
public void Enable(string name, bool dueToRules)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException(nameof(name));
}
if (InternalItems.TryGetValue(name, out T value))
{
Enable(value,dueToRules);
}
}
/// <summary>
/// Enables all.
/// </summary>
/// <param name="dueToRules">
/// if set to <c>true</c> [due to rules].
/// </param>
public void EnableAll(bool dueToRules)
{
foreach (var value in InternalItems.Values.Where(applied => !applied.IsEnabled))
{
Enable(value, dueToRules);
}
}
}
}