ToCallbackString() public method

public ToCallbackString ( string callbackId, string successCallback, string errorCallback ) : string
callbackId string
successCallback string
errorCallback string
return string
Ejemplo n.º 1
0
        private void InvokeJSSCallback(String callbackId, PluginResult result)
        {
            if (String.IsNullOrEmpty(callbackId))
            {
                throw new ArgumentNullException("callbackId");
            }

            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            string callBackScript = result.ToCallbackString(callbackId, "commandResult", "commandError");

            // TODO: this is correct invokation method
            //this.GapBrowser.InvokeScript("eval", new string[] {callBackScript });

            /// But we temporary use this version because C#<->JS bridge is not fully ready
            if (result.IsSuccess)
            {
                this.GapBrowser.InvokeScript("commandResult", new string[] { callbackId, result.ToJSONString() });
            }
            else
            {
                this.GapBrowser.InvokeScript("commandError", new string[] { callbackId, result.ToJSONString() });
            }
        }