/// <summary>
/// Handles command execution result.
/// </summary>
/// <param name="callbackId">Command callback identifier on client side</param>
/// <param name="result">Execution result</param>
private void OnCommandResult(string callbackId, PluginResult result)
{
#region args checking
if (result == null)
{
Debug.WriteLine("OnCommandResult missing result argument");
return;
}
if (String.IsNullOrEmpty(callbackId))
{
Debug.WriteLine("OnCommandResult missing callbackId argument");
return;
}
#endregion
string status = ((int)result.Result).ToString();
string jsonResult = result.ToJSONString();
ScriptCallback scriptCallback = null;
if (String.IsNullOrEmpty(result.Cast))
{
scriptCallback = new ScriptCallback("PhoneGapCommandResult", new string[] { status, callbackId, jsonResult });
}
else
{
scriptCallback = new ScriptCallback("PhoneGapCommandResult", new string[] { status, callbackId, jsonResult, result.Cast });
}
this.InvokeScriptCallback(scriptCallback);
}