/// <summary> /// CallJavaScriptMethod /// </summary> /// <param name="methodName"></param> /// <param name="args"></param> /// <returns></returns> string CallJavaScriptMethod( string methodName, params string[] args) { LoadInitialPage(); // be sure initial page is loaded string result = JavaScriptManager.CallFunction(this, methodName, args); return(result); }
/// <summary> /// Get molfile form of structure /// </summary> /// <param name="outputFormat">molfile, molfile2000 or molfile3000</param> /// <returns></returns> public string GetMolfile( string outputFormat = "molfile") { if (Debug) { DebugLog.Message("GetMolfile Entered" + IdText); } Stopwatch sw = Stopwatch.StartNew(); // Define the JavaScript function to get the molfile for the KekuleJs //string script = @" // function getMolfileString() { // var data = { jsdraw: jsd.getXml(), outputformat: 'molfile' }; // var result = scil.Utils.ajaxwait( // call ajax to invoke the service // JSDrawServices.url + '?cmd=jsdraw.KekuleJs2mol', // the url and command // data); // the data); i.e. parameters for service call // return result == null ? null : result.output // } //"; //script = script.Replace("<outputFormat>", outputFormat); //JavaScriptManager.ExecuteJavaScript(Browser, script); string molfile = JavaScriptManager.CallFunction(this, "getMolfileString"); // call asynch function to get the molfile string txt = (molfile != null ? molfile.Length.ToString() : "<null>"); if (Debug) { DebugLog.StopwatchMessage("GetMolfileString Complete: " + txt + ", Time: ", sw); } return(molfile); }