Skip to content

Instantly share code, notes, and snippets.

@spearson
Created June 5, 2020 01:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spearson/e27f524ddc777d4a5c2102902dc50af6 to your computer and use it in GitHub Desktop.
Save spearson/e27f524ddc777d4a5c2102902dc50af6 to your computer and use it in GitHub Desktop.
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