-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from bridgefield/cleanup
cleanup for first release
- Loading branch information
Showing
12 changed files
with
92 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bridgefield/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using bridgefield.FoundationalBits.Agents; | ||
|
||
namespace bridgefield.FoundationalBits | ||
{ | ||
public static class Agent | ||
{ | ||
public static IAgent<TCommand, TReply> Start<TState, TCommand, TReply>( | ||
TState initialState, | ||
Func<TState, TCommand, Task<(TState newState, TReply reply)>> update) | ||
=> new StatefulAgent<TState, TCommand, TReply>(initialState, update); | ||
|
||
public static IAgent<TCommand, TReply> Start<TCommand, TReply>( | ||
Func<TCommand, Task<TReply>> update) | ||
=> new StatelessAgent<TCommand, TReply>(update); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
|
||
namespace bridgefield.FoundationalBits.Agents | ||
{ | ||
internal static class Tasks | ||
{ | ||
public static Task HandleResult<T>( | ||
this Task<T> task, | ||
Action<T> onSuccess, | ||
Action<Exception> onError) => | ||
task.ContinueWith(t => | ||
{ | ||
if (t.IsFaulted) | ||
{ | ||
onError(task.Exception); | ||
} | ||
else | ||
{ | ||
onSuccess(task.Result); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using bridgefield.FoundationalBits.Agents; | ||
|
||
namespace bridgefield.FoundationalBits | ||
{ | ||
// ReSharper disable once TypeParameterCanBeVariant | ||
public interface IAgent<TCommand, TReply> | ||
{ | ||
Task<TReply> Tell(TCommand command); | ||
|
||
static IAgent<TCommand, TReply> Start<TState>( | ||
TState initialState, | ||
Func<TState, TCommand, Task<(TState newState, TReply reply)>> update) | ||
=> new StatefulAgent<TState, TCommand, TReply>(initialState, update); | ||
|
||
static IAgent<TCommand, TReply> Start(Func<TCommand, Task<TReply>> update) | ||
=> new StatelessAgent<TCommand, TReply>(update); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using bridgefield.FoundationalBits.Messaging; | ||
|
||
namespace bridgefield.FoundationalBits | ||
{ | ||
public static class MessageBus | ||
{ | ||
public static IMessageBus Create() => new AgentBasedMessageBus(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters