Example #1
0
        /// <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);
        }
Example #2
0
        /// <summary>
        /// ExecuteJavaScript
        /// </summary>
        /// <param name="script"></param>

        void ExecuteJavaScript(string script)
        {
            LoadInitialPage();             // be sure initial page is loaded
            JavaScriptManager.ExecuteScript(this, script);
            return;
        }