Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public abstract class AsyncCommand : Command
{
public override void Execute(CommandContext context)
{
if (context == null)
return;
try
{
Context.ClientPage.Start(this, "Run", PrepareArgs(context));
}
catch (Exception ex)
{
Sitecore.Diagnostics.Log.Error(ex.Message, ex, this);
throw;
}
}
protected virtual NameValueCollection PrepareArgs(CommandContext context)
{
var item = context.Items[0];
var args = new NameValueCollection()
{
{ "id", item.ID.ToString() },
{ "language", item.Language.ToString() },
{ "version", item.Version.ToString() },
};
return args;
}
protected abstract void Run(ClientPipelineArgs args);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment