Skip to content

Commit 8630177

Browse files
author
Andy Adamczak
committed
Fixed a bug in the multi-threaded implementation of the Observer.
Made all public function virtual so the framework is easier to subclass.
1 parent 847f3a7 commit 8630177

File tree

105 files changed

+387
-384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+387
-384
lines changed

PureMVC.DotNET.2008.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
35-
[assembly: AssemblyFileVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]
35+
[assembly: AssemblyFileVersion("3.1.0.0")]

PureMVC.DotNET.2008/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.0.0.0")]
36-
[assembly: AssemblyFileVersion("3.0.0.0")]
35+
[assembly: AssemblyVersion("3.1.0.0")]
36+
[assembly: AssemblyFileVersion("3.1.0.0")]

PureMVC.DotNET.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.0.0.0")]
36-
[assembly: AssemblyFileVersion("3.0.0.0")]
35+
[assembly: AssemblyVersion("3.1.0.0")]
36+
[assembly: AssemblyFileVersion("3.1.0.0")]

PureMVC.DotNET.VS2008.PocketPC.Tests/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]

PureMVC.DotNET.VS2008.PocketPC/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.0.0.0")]
35+
[assembly: AssemblyVersion("3.1.0.0")]

PureMVC.DotNET.VS2008.SmartPhone.Tests/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("1.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]

PureMVC.DotNET.VS2008.SmartPhone/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]
3535

PureMVC.DotNET.VS2008.WindowsCE.Tests/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("1.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]

PureMVC.DotNET.VS2008.WindowsCE/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]
3535

PureMVC.DotNET/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.0.0.0")]
36-
[assembly: AssemblyFileVersion("3.0.0.0")]
35+
[assembly: AssemblyVersion("3.1.0.0")]
36+
[assembly: AssemblyFileVersion("3.1.0.0")]

PureMVC.DotNETCF.Tests/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]

PureMVC.DotNETCF/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]

PureMVC.Silverlight.20.Tests/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
35-
[assembly: AssemblyFileVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]
35+
[assembly: AssemblyFileVersion("3.1.0.0")]

PureMVC.Silverlight.20/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
//
3232
// You can specify all the values or you can default the Revision and Build Numbers
3333
// by using the '*' as shown below:
34-
[assembly: AssemblyVersion("3.0.0.0")]
35-
[assembly: AssemblyFileVersion("3.0.0.0")]
34+
[assembly: AssemblyVersion("3.1.0.0")]
35+
[assembly: AssemblyFileVersion("3.1.0.0")]

PureMVC.doxygen

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ PROJECT_NAME = PureMVC
3131
# This could be handy for archiving the generated documentation or
3232
# if some version control system is used.
3333

34-
PROJECT_NUMBER = 3.0
34+
PROJECT_NUMBER = 3.1
3535

3636
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
3737
# base path where the generated documentation will be put.

PureMVC/Patterns/Command/MacroCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public MacroCommand()
5757
/// <remarks>
5858
/// <para>The <i>SubCommands</i> will be called in First In/First Out (FIFO) order</para>
5959
/// </remarks>
60-
public void Execute(INotification notification)
60+
public virtual void Execute(INotification notification)
6161
{
6262
while (m_subCommands.Count > 0)
6363
{

PureMVC/Patterns/Facade/Facade.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ protected Facade()
164164
/// </summary>
165165
/// <param name="proxy">The <c>IProxy</c> to be registered with the <c>Model</c></param>
166166
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
167-
public void RegisterProxy(IProxy proxy)
167+
public virtual void RegisterProxy(IProxy proxy)
168168
{
169169
// The model is initialized in the constructor of the singleton, so this call should be thread safe.
170170
// This method is thread safe on the model.
@@ -177,7 +177,7 @@ public void RegisterProxy(IProxy proxy)
177177
/// <param name="proxyName">The name of the <c>IProxy</c> instance to be retrieved</param>
178178
/// <returns>The <c>IProxy</c> previously regisetered by <c>proxyName</c> with the <c>Model</c></returns>
179179
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
180-
public IProxy RetrieveProxy(string proxyName)
180+
public virtual IProxy RetrieveProxy(string proxyName)
181181
{
182182
// The model is initialized in the constructor of the singleton, so this call should be thread safe.
183183
// This method is thread safe on the model.
@@ -189,7 +189,7 @@ public IProxy RetrieveProxy(string proxyName)
189189
/// </summary>
190190
/// <param name="proxyName">The <c>IProxy</c> to remove from the <c>Model</c></param>
191191
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
192-
public IProxy RemoveProxy(string proxyName)
192+
public virtual IProxy RemoveProxy(string proxyName)
193193
{
194194
// The model is initialized in the constructor of the singleton, so this call should be thread safe.
195195
// This method is thread safe on the model.
@@ -202,7 +202,7 @@ public IProxy RemoveProxy(string proxyName)
202202
/// <param name="proxyName">The name of the <c>IProxy</c> instance to check for</param>
203203
/// <returns>whether a Proxy is currently registered with the given <c>proxyName</c>.</returns>
204204
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
205-
public bool HasProxy(string proxyName)
205+
public virtual bool HasProxy(string proxyName)
206206
{
207207
// The model is initialized in the constructor of the singleton, so this call should be thread safe.
208208
// This method is thread safe on the model.
@@ -219,7 +219,7 @@ public bool HasProxy(string proxyName)
219219
/// <param name="notificationName">The name of the <c>INotification</c> to associate the <c>ICommand</c> with.</param>
220220
/// <param name="commandType">A reference to the <c>Type</c> of the <c>ICommand</c></param>
221221
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
222-
public void RegisterCommand(string notificationName, Type commandType)
222+
public virtual void RegisterCommand(string notificationName, Type commandType)
223223
{
224224
// The controller is initialized in the constructor of the singleton, so this call should be thread safe.
225225
// This method is thread safe on the controller.
@@ -231,7 +231,7 @@ public void RegisterCommand(string notificationName, Type commandType)
231231
/// </summary>
232232
/// <param name="notificationName">TRemove a previously registered <c>ICommand</c> to <c>INotification</c> mapping from the Controller.</param>
233233
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
234-
public void RemoveCommand(string notificationName)
234+
public virtual void RemoveCommand(string notificationName)
235235
{
236236
// The controller is initialized in the constructor of the singleton, so this call should be thread safe.
237237
// This method is thread safe on the controller.
@@ -244,7 +244,7 @@ public void RemoveCommand(string notificationName)
244244
/// <param name="notificationName">The name of the <c>INotification</c> to check for.</param>
245245
/// <returns>whether a Command is currently registered for the given <c>notificationName</c>.</returns>
246246
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
247-
public bool HasCommand(string notificationName)
247+
public virtual bool HasCommand(string notificationName)
248248
{
249249
// The controller is initialized in the constructor of the singleton, so this call should be thread safe.
250250
// This method is thread safe on the controller.
@@ -260,7 +260,7 @@ public bool HasCommand(string notificationName)
260260
/// </summary>
261261
/// <param name="mediator">A reference to the <c>IMediator</c> instance</param>
262262
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
263-
public void RegisterMediator(IMediator mediator)
263+
public virtual void RegisterMediator(IMediator mediator)
264264
{
265265
// The view is initialized in the constructor of the singleton, so this call should be thread safe.
266266
// This method is thread safe on the view.
@@ -273,7 +273,7 @@ public void RegisterMediator(IMediator mediator)
273273
/// <param name="mediatorName">The name of the <c>IMediator</c> instance to retrieve</param>
274274
/// <returns>The <c>IMediator</c> previously registered with the given <c>mediatorName</c></returns>
275275
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
276-
public IMediator RetrieveMediator(string mediatorName)
276+
public virtual IMediator RetrieveMediator(string mediatorName)
277277
{
278278
// The view is initialized in the constructor of the singleton, so this call should be thread safe.
279279
// This method is thread safe on the view.
@@ -285,7 +285,7 @@ public IMediator RetrieveMediator(string mediatorName)
285285
/// </summary>
286286
/// <param name="mediatorName">The name of the <c>IMediator</c> instance to be removed</param>
287287
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
288-
public IMediator RemoveMediator(string mediatorName)
288+
public virtual IMediator RemoveMediator(string mediatorName)
289289
{
290290
// The view is initialized in the constructor of the singleton, so this call should be thread safe.
291291
// This method is thread safe on the view.
@@ -298,7 +298,7 @@ public IMediator RemoveMediator(string mediatorName)
298298
/// <param name="mediatorName">The name of the <c>IMediator</c> instance to check for</param>
299299
/// <returns>whether a Mediator is registered with the given <code>mediatorName</code>.</returns>
300300
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
301-
public bool HasMediator(string mediatorName)
301+
public virtual bool HasMediator(string mediatorName)
302302
{
303303
// The view is initialized in the constructor of the singleton, so this call should be thread safe.
304304
// This method is thread safe on the view.
@@ -316,7 +316,7 @@ public bool HasMediator(string mediatorName)
316316
/// <remarks>Usually you should just call sendNotification and pass the parameters, never having to construct the notification yourself.</remarks>
317317
/// <param name="notification">The <c>INotification</c> to have the <c>View</c> notify observers of</param>
318318
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
319-
public void NotifyObservers(INotification notification)
319+
public virtual void NotifyObservers(INotification notification)
320320
{
321321
// The view is initialized in the constructor of the singleton, so this call should be thread safe.
322322
// This method is thread safe on the view.
@@ -335,7 +335,7 @@ public void NotifyObservers(INotification notification)
335335
/// <param name="notificationName">The name of the notiification to send</param>
336336
/// <remarks>Keeps us from having to construct new notification instances in our implementation code</remarks>
337337
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
338-
public void SendNotification(string notificationName)
338+
public virtual void SendNotification(string notificationName)
339339
{
340340
NotifyObservers(new Notification(notificationName));
341341
}
@@ -347,7 +347,7 @@ public void SendNotification(string notificationName)
347347
/// <param name="body">The body of the notification</param>
348348
/// <remarks>Keeps us from having to construct new notification instances in our implementation code</remarks>
349349
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
350-
public void SendNotification(string notificationName, object body)
350+
public virtual void SendNotification(string notificationName, object body)
351351
{
352352
NotifyObservers(new Notification(notificationName, body));
353353
}
@@ -360,7 +360,7 @@ public void SendNotification(string notificationName, object body)
360360
/// <param name="type">The type of the notification</param>
361361
/// <remarks>Keeps us from having to construct new notification instances in our implementation code</remarks>
362362
/// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks>
363-
public void SendNotification(string notificationName, object body, string type)
363+
public virtual void SendNotification(string notificationName, object body, string type)
364364
{
365365
NotifyObservers(new Notification(notificationName, body, type));
366366
}

PureMVC/Patterns/Mediator/Mediator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public virtual string MediatorName
134134
/// </code>
135135
/// </example>
136136
/// </remarks>
137-
public object ViewComponent
137+
public virtual object ViewComponent
138138
{
139139
get { return m_viewComponent; }
140140
set { m_viewComponent = value; }

PureMVC/Patterns/Observer/Notification.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public override string ToString()
8080
/// <summary>
8181
/// The name of the <c>Notification</c> instance
8282
/// </summary>
83-
public string Name
83+
public virtual string Name
8484
{
8585
get { return m_name; }
8686
}
@@ -89,7 +89,7 @@ public string Name
8989
/// The body of the <c>Notification</c> instance
9090
/// </summary>
9191
/// <remarks>This accessor is thread safe</remarks>
92-
public object Body
92+
public virtual object Body
9393
{
9494
get
9595
{
@@ -107,7 +107,7 @@ public object Body
107107
/// The type of the <c>Notification</c> instance
108108
/// </summary>
109109
/// <remarks>This accessor is thread safe</remarks>
110-
public string Type
110+
public virtual string Type
111111
{
112112
get
113113
{

PureMVC/Patterns/Observer/Notifier.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Notifier : INotifier
4141
/// <param name="notificationName">The name of the notiification to send</param>
4242
/// <remarks>Keeps us from having to construct new notification instances in our implementation code</remarks>
4343
/// <remarks>This method is thread safe</remarks>
44-
public void SendNotification(string notificationName)
44+
public virtual void SendNotification(string notificationName)
4545
{
4646
// The Facade SendNotification is thread safe, therefore this method is thread safe.
4747
m_facade.SendNotification(notificationName);
@@ -54,7 +54,7 @@ public void SendNotification(string notificationName)
5454
/// <param name="body">The body of the notification</param>
5555
/// <remarks>Keeps us from having to construct new notification instances in our implementation code</remarks>
5656
/// <remarks>This method is thread safe</remarks>
57-
public void SendNotification(string notificationName, object body)
57+
public virtual void SendNotification(string notificationName, object body)
5858
{
5959
// The Facade SendNotification is thread safe, therefore this method is thread safe.
6060
m_facade.SendNotification(notificationName, body);
@@ -68,7 +68,7 @@ public void SendNotification(string notificationName, object body)
6868
/// <param name="type">The type of the notification</param>
6969
/// <remarks>Keeps us from having to construct new notification instances in our implementation code</remarks>
7070
/// <remarks>This method is thread safe</remarks>
71-
public void SendNotification(string notificationName, object body, string type)
71+
public virtual void SendNotification(string notificationName, object body, string type)
7272
{
7373
// The Facade SendNotification is thread safe, therefore this method is thread safe.
7474
m_facade.SendNotification(notificationName, body, type);

PureMVC/Patterns/Observer/Observer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public Observer(string notifyMethod, object notifyContext)
5959
/// </summary>
6060
/// <remarks>This method is thread safe</remarks>
6161
/// <param name="notification">The <c>INotification</c> to pass to the interested object's notification method</param>
62-
public void NotifyObserver(INotification notification)
62+
public virtual void NotifyObserver(INotification notification)
6363
{
6464
object context;
6565
string method;
@@ -73,7 +73,7 @@ public void NotifyObserver(INotification notification)
7373

7474
Type t = context.GetType();
7575
BindingFlags f = BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase;
76-
MethodInfo mi = t.GetMethod(NotifyMethod, f);
76+
MethodInfo mi = t.GetMethod(method, f);
7777
mi.Invoke(context, new object[] { notification });
7878
}
7979

@@ -83,7 +83,7 @@ public void NotifyObserver(INotification notification)
8383
/// <remarks>This method is thread safe</remarks>
8484
/// <param name="obj">The object to compare</param>
8585
/// <returns>Indicating if the object and the notification context are the same</returns>
86-
public bool CompareNotifyContext(object obj)
86+
public virtual bool CompareNotifyContext(object obj)
8787
{
8888
lock (m_syncRoot)
8989
{
@@ -103,7 +103,7 @@ public bool CompareNotifyContext(object obj)
103103
/// </summary>
104104
/// <remarks>The notification method should take one parameter of type <c>INotification</c></remarks>
105105
/// <remarks>This accessor is thread safe</remarks>
106-
public string NotifyMethod
106+
public virtual string NotifyMethod
107107
{
108108
private get
109109
{
@@ -121,7 +121,7 @@ private get
121121
/// The notification context (this) of the interested object
122122
/// </summary>
123123
/// <remarks>This accessor is thread safe</remarks>
124-
public object NotifyContext
124+
public virtual object NotifyContext
125125
{
126126
private get
127127
{

PureMVC/Patterns/Proxy/Proxy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ public virtual void OnRemove()
9696
/// Get the proxy name
9797
/// </summary>
9898
/// <returns></returns>
99-
public string ProxyName
99+
public virtual string ProxyName
100100
{
101101
get { return m_proxyName; }
102102
}
103103

104104
/// <summary>
105105
/// Set the data object
106106
/// </summary>
107-
public object Data
107+
public virtual object Data
108108
{
109109
get { return m_data; }
110110
set { m_data = value; }

bin/PureMVC.DotNET.35.PocketPC.dll

-512 Bytes
Binary file not shown.

bin/PureMVC.DotNET.35.SmartPhone.dll

-512 Bytes
Binary file not shown.

bin/PureMVC.DotNET.35.WindowsCE.dll

-512 Bytes
Binary file not shown.

bin/PureMVC.DotNET.35.dll

-512 Bytes
Binary file not shown.

bin/PureMVC.Silverlight.20.dll

-512 Bytes
Binary file not shown.

doc/html/_controller_8cs.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

doc/html/_facade_8cs.html

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)