File tree Expand file tree Collapse file tree 2 files changed +43
-28
lines changed Expand file tree Collapse file tree 2 files changed +43
-28
lines changed Original file line number Diff line number Diff line change
1
+ #region Copyright & License Information
2
+ /*
3
+ * Copyright (c) The OpenRA Developers and Contributors
4
+ * This file is part of OpenRA, which is free software. It is made
5
+ * available to you under the terms of the GNU General Public License
6
+ * as published by the Free Software Foundation, either version 3 of
7
+ * the License, or (at your option) any later version. For more
8
+ * information, see COPYING.
9
+ */
10
+ #endregion
11
+
12
+ using OpenRA . Primitives ;
13
+
14
+ namespace OpenRA . Widgets
15
+ {
16
+ public sealed class Mediator
17
+ {
18
+ readonly TypeDictionary types = new ( ) ;
19
+
20
+ public void Subscribe < T > ( T instance )
21
+ {
22
+ types . Add ( instance ) ;
23
+ }
24
+
25
+ public void Unsubscribe < T > ( T instance )
26
+ {
27
+ types . Remove ( instance ) ;
28
+ }
29
+
30
+ public void Send < T > ( T notification )
31
+ {
32
+ var handlers = types . WithInterface < INotificationHandler < T > > ( ) ;
33
+
34
+ foreach ( var handler in handlers )
35
+ handler . Handle ( notification ) ;
36
+ }
37
+ }
38
+
39
+ public interface INotificationHandler < T >
40
+ {
41
+ void Handle ( T notification ) ;
42
+ }
43
+ }
Original file line number Diff line number Diff line change @@ -441,32 +441,4 @@ public WidgetArgs(Dictionary<string, object> args)
441
441
: base ( args ) { }
442
442
public void Add ( string key , Action val ) { base . Add ( key , val ) ; }
443
443
}
444
-
445
- public sealed class Mediator
446
- {
447
- readonly TypeDictionary types = new ( ) ;
448
-
449
- public void Subscribe < T > ( T instance )
450
- {
451
- types . Add ( instance ) ;
452
- }
453
-
454
- public void Unsubscribe < T > ( T instance )
455
- {
456
- types . Remove ( instance ) ;
457
- }
458
-
459
- public void Send < T > ( T notification )
460
- {
461
- var handlers = types . WithInterface < INotificationHandler < T > > ( ) ;
462
-
463
- foreach ( var handler in handlers )
464
- handler . Handle ( notification ) ;
465
- }
466
- }
467
-
468
- public interface INotificationHandler < T >
469
- {
470
- void Handle ( T notification ) ;
471
- }
472
444
}
You can’t perform that action at this time.
0 commit comments