Created
June 5, 2020 01:32
-
-
Save spearson/e27f524ddc777d4a5c2102902dc50af6 to your computer and use it in GitHub Desktop.
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
namespace xofz.Root.Commands | |
{ | |
using System; | |
using System.Threading; | |
using xofz.Framework; | |
public class SampleActionActionCommand | |
: Command | |
{ | |
public SampleActionActionCommand( | |
MethodWeb web) | |
{ | |
this.web = web; | |
} | |
public override void Execute() | |
{ | |
var w = this.web; | |
this.registerDependencies(); | |
} | |
protected virtual void registerDependencies() | |
{ | |
var w = this.web; | |
w.RegisterDependency((Do<Do>)(act => | |
{ | |
ThreadPool.QueueUserWorkItem(o => | |
{ | |
act?.Invoke(); | |
}); | |
})); | |
// alternatively, an Action<Action> may be registered | |
w.RegisterDependency((Action<Action>)(act => | |
{ | |
ThreadPool.QueueUserWorkItem(o => | |
{ | |
act?.Invoke(); | |
}); | |
})); | |
} | |
protected readonly MethodWeb web; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment