예제 #1
0
        /// <summary>
        /// Executes a code
        /// </summary>
        /// <param name="code">JavaScript code</param>
        /// <exception cref="System.ObjectDisposedException">Operation is performed on a disposed MSIE
        /// JavaScript engine.</exception>
        /// <exception cref="System.ArgumentException" />
        /// <exception cref="MsieJavaScriptEngine.JsRuntimeException">JavaScript runtime error.</exception>
        public void Execute(string code)
        {
            VerifyNotDisposed();

            if (string.IsNullOrWhiteSpace(code))
            {
                throw new ArgumentException(
                          string.Format(CommonStrings.Common_ArgumentIsEmpty, "code"), "code");
            }

            _jsEngine.Execute(code);
        }
예제 #2
0
        /// <summary>
        /// Executes a code
        /// </summary>
        /// <param name="code">JavaScript code</param>
        /// <param name="documentName">Document name</param>
        /// <exception cref="System.ObjectDisposedException">Operation is performed on a disposed MSIE
        /// JavaScript engine.</exception>
        /// <exception cref="System.ArgumentException" />
        /// <exception cref="MsieJavaScriptEngine.JsRuntimeException">JavaScript runtime error.</exception>
        public void Execute(string code, string documentName)
        {
            VerifyNotDisposed();

            if (string.IsNullOrWhiteSpace(code))
            {
                throw new ArgumentException(
                          string.Format(CommonStrings.Common_ArgumentIsEmpty, "code"), "code");
            }

            string uniqueDocumentName = _documentNameManager.GetUniqueName(documentName);

            _jsEngine.Execute(code, uniqueDocumentName);
        }