-
Notifications
You must be signed in to change notification settings - Fork 8
Added Async support #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 5 commits
4f31bbc
31a3d09
1e9295d
b563c90
22d3cb6
1387c6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,14 +4,15 @@ | |
|
|
||
| namespace EventAggregatorNet.SampleUsage.Samples | ||
| { | ||
| #if ASYNC | ||
| public class AsyncSample | ||
| { | ||
| public static void Run() | ||
| { | ||
| var config = new EventAggregator.Config | ||
| { | ||
| // Make the marshaler run in the background thread | ||
| DefaultThreadMarshaler = action => Task.Factory.StartNew(action), | ||
| DefaultThreadAsyncMarshaler = async action => await Task.Factory.StartNew(action), | ||
|
||
| }; | ||
|
|
||
| var eventAggregationManager = new EventAggregator(config); | ||
|
|
@@ -24,13 +25,18 @@ public static void Run() | |
| } | ||
|
|
||
|
|
||
| public class LongRunningHandler : IListener<SampleEventMessage> | ||
| public class LongRunningHandler : IListenerAsync<SampleEventMessage> | ||
| { | ||
| public void Handle(SampleEventMessage message) | ||
| public async Task Handle(SampleEventMessage message) | ||
| { | ||
| "LongRunningHandler - Received event".Log(); | ||
| Thread.Sleep(1000); | ||
| "LongRunningHandler - Done with work".Log(); | ||
| await Task.Factory.StartNew(() => | ||
|
||
| { | ||
| "LongRunningHandler - Received event".Log(); | ||
| Thread.Sleep(1000); | ||
|
|
||
| "LongRunningHandler - Done with work".Log(); | ||
| }); | ||
| } | ||
| } | ||
| #endif | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <configuration> | ||
| <runtime> | ||
| <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" /> | ||
| </dependentAssembly> | ||
| <dependentAssembly> | ||
| <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> | ||
| <bindingRedirect oldVersion="0.0.0.0-2.6.10.0" newVersion="2.6.10.0" /> | ||
| </dependentAssembly> | ||
| </assemblyBinding> | ||
| </runtime> | ||
| </configuration> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <packages> | ||
| <package id="EventAggregator.Net" version="0.1" /> | ||
| <package id="Microsoft.Bcl" version="1.1.10" targetFramework="net4-client" /> | ||
| <package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net4-client" /> | ||
| <package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net4-client" /> | ||
| </packages> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual event aggregator project has been updated to 4.6, why not this proj?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This project targets .NET Client Profile framework that has been discontinued (see HERE)