Last active
July 7, 2017 21:33
-
-
Save celston/5e9b1951624004b7af42a6772a53a6f0 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
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