当前位置: 首页>>代码示例>>C#>>正文


C# JSObject.HasProperty方法代码示例

本文整理汇总了C#中JSObject.HasProperty方法的典型用法代码示例。如果您正苦于以下问题:C# JSObject.HasProperty方法的具体用法?C# JSObject.HasProperty怎么用?C# JSObject.HasProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JSObject的用法示例。


在下文中一共展示了JSObject.HasProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteDontDeletePropertyTest

 public void DeleteDontDeletePropertyTest()
 {
     var obj = new JSObject (context, null);
     obj.SetProperty ("foo", new JSValue (context, "i am permanent"), JSPropertyAttribute.DontDelete);
     Assert.IsTrue (obj.HasProperty ("foo"));
     Assert.IsFalse (obj.DeleteProperty ("foo"));
     Assert.IsTrue (obj.HasProperty ("foo"));
 }
开发者ID:knocte,项目名称:banshee,代码行数:8,代码来源:JSObjectTests.cs

示例2: ProcessRequest

        /// <summary>
        /// Handle a request.
        /// </summary>
        /// <param name="pDisplay">The display which called this function.</param>
        /// <param name="pSurface">The surface which this display is hosted on.</param>
        /// <param name="dArguments">A dictionary of arguments which are passed to the function as parameters.</param>
        /// <returns>True if the request was processed sucessfully.  False if there was an error.</returns>
        public bool ProcessRequest(Display pDisplay, Surface pSurface, JSObject dArguments)
        {
            // Check we have a function to return the results too.
            if (!dArguments.HasProperty("callback")) throw new Exception("Missing 'callback' argument.");

            // Return a list of surface names.
            JSValue[] lSurfaces = (from pSurf in Authority.Surfaces select new JSValue(pSurf.Identifier)).ToArray();

            // If that function is a string.
            var jsValue = dArguments["callback"];
            if (jsValue.IsString)
            {
                pDisplay.AsyncCallGlobalFunction(jsValue.ToString(), lSurfaces);
                return true;
            }

            /*
            // If it is a function.
            else if (jsValue.IsObject)
            {
                ((JSObject)jsValue).Invoke("call", lSurfaces);
                return true;
            }
            */

            // Throw the error.
            throw new Exception("Unknown type specified in 'callback' argument.  Expected string.");
        }
开发者ID:iNabarawy,项目名称:ubidisplays,代码行数:35,代码来源:SurfaceList.cs

示例3: DeletePropertyTest

 public void DeletePropertyTest()
 {
     var obj = new JSObject (context, null);
     obj.SetProperty ("foo", new JSValue (context, "bar"));
     Assert.IsTrue (obj.HasProperty ("foo"));
     Assert.IsTrue (obj.DeleteProperty ("foo"));
     Assert.IsFalse (obj.HasProperty ("foo"));
     obj.SetProperty ("foo", new JSValue (context, 99));
     Assert.IsTrue (obj.HasProperty ("foo"));
     Assert.IsTrue (obj.DeleteProperty ("foo"));
     Assert.IsFalse (obj.HasProperty ("foo"));
 }
开发者ID:knocte,项目名称:banshee,代码行数:12,代码来源:JSObjectTests.cs

示例4: HasRelevantId

 public bool HasRelevantId(JSObject iJSObject)
 {
     return ((iJSObject!=null) &&( iJSObject.HasProperty("_MappedId")));
 }
开发者ID:skyaxl,项目名称:MVVM-for-awesomium,代码行数:4,代码来源:LocalBuilder.cs

示例5: SetPropertyTest

        public void SetPropertyTest()
        {
            var obj = new JSObject (context, null);
            var prop = new JSValue (context, "happy days");

            obj.SetProperty ("str", prop);
            Assert.IsTrue (obj.HasProperty ("str"));
            Assert.IsTrue (obj.GetProperty ("str").IsEqual (prop));
            Assert.IsTrue (obj.GetProperty ("str").IsStrictEqual (prop));
            Assert.AreEqual ("happy days", obj.GetProperty ("str").StringValue);

            obj.SetProperty ("str", obj);
            Assert.IsTrue (obj.GetProperty ("str").IsEqual (obj));
            Assert.IsTrue (obj.GetProperty ("str").IsStrictEqual (obj));
        }
开发者ID:knocte,项目名称:banshee,代码行数:15,代码来源:JSObjectTests.cs

示例6: ReadOnlyPropertyTest

 public void ReadOnlyPropertyTest()
 {
     var obj = new JSObject (context, null);
     obj.SetProperty ("foo", new JSValue (context, "bar"), JSPropertyAttribute.ReadOnly);
     Assert.AreEqual ("bar", obj.GetProperty ("foo").StringValue);
     obj.SetProperty ("foo", new JSValue (context, "baz"));
     Assert.AreEqual ("bar", obj.GetProperty ("foo").StringValue);
     Assert.IsTrue (obj.DeleteProperty ("foo"));
     Assert.IsFalse (obj.HasProperty ("foo"));
 }
开发者ID:knocte,项目名称:banshee,代码行数:10,代码来源:JSObjectTests.cs


注:本文中的JSObject.HasProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。