private IJavaScriptValue Echo(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
        {
            string arg = args.First().ToString();
            arg = arg.Replace("{", "{{").Replace("}", "}}");
            Log.Message(string.Format(arg, (object[])args.Skip(1).ToArray()));

            if (arg == "toast promise done")
            {
                Assert.Succeeded();
            }
            return source.UndefinedValue;
        }
        private IJavaScriptValue EchoForProjectedNamespace(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
        {
            string arg = args.First().ToString();
            arg = arg.Replace("{", "{{").Replace("}", "}}");
            Debug.WriteLine(string.Format(arg, (object[])args.Skip(1).ToArray()));

            if (arg == "toast promise done")
            {
                successSignal.SetResult(0);
            }
            return source.UndefinedValue;
        }
        private IJavaScriptValue Echo(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
        {
            string arg = args.First().ToString();

            arg = arg.Replace("{", "{{").Replace("}", "}}");
            Log.Message(string.Format(arg, (object[])args.Skip(1).ToArray()));

            if (arg == "toast promise done")
            {
                Assert.Succeeded();
            }
            return(source.UndefinedValue);
        }
Beispiel #4
0
        public bool SetProperty(string name, IJavaScriptValue value)
        {
            ThrowIfDisposed();
            PropertyInfo property;
            var          nativeObject = NativeObject;

            if (nativeObject == null || !_properties.TryGetValue(name, out property))
            {
                return(false);
            }

            var convertedValue = value.GetConvertedValue(property);

            property.SetValue(nativeObject, convertedValue, null);
            return(true);
        }
Beispiel #5
0
 private IJavaScriptValue Echo(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
 {
     Log.Message(string.Format(args.First().ToString(), (object[])args.Skip(1).ToArray()));
     return(source.UndefinedValue);
 }
Beispiel #6
0
 private IJavaScriptValue Echo(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
 {
     Log.Message(string.Format(args.First().ToString(), (object[])args.Skip(1).ToArray()));
     return source.UndefinedValue;
 }
 private IJavaScriptValue Success(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
 {
     successSignal.SetResult(0);
     return(source.UndefinedValue);
 }
        private IJavaScriptValue EchoForProjectedNamespace(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
        {
            string arg = args.First().ToString();

            arg = arg.Replace("{", "{{").Replace("}", "}}");
            Debug.WriteLine(string.Format(arg, (object[])args.Skip(1).ToArray()));

            if (arg == "toast promise done")
            {
                successSignal.SetResult(0);
            }
            return(source.UndefinedValue);
        }
        private IJavaScriptValue MessageDialog(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
        {
            if (!construct)
            {
                var undefined = source.UndefinedValue;
                source.SetException(source.CreateTypeError("Must call as a constructor."));
                return(undefined);
            }

            var dlg = new MessageDialog(args.First().ToString());

            return(source.Converter.FromWindowsRuntimeObject(dlg));
        }
        private IJavaScriptValue EchoForNoNamespace(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
        {
            string arg = args.First().ToString();

            Assert.AreEqual("callback completed", arg);
            successSignal.SetResult(0);
            return(source.UndefinedValue);
        }
 private IJavaScriptValue Failure(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable <IJavaScriptValue> args)
 {
     Assert.Fail();
     return(source.UndefinedValue);
 }
Beispiel #12
0
 private IJavaScriptValue Success(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
 {
     successSignal.SetResult(0);
     return source.UndefinedValue;
 }
Beispiel #13
0
        private IJavaScriptValue MessageDialog(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
        {
            if (!construct)
            {
                var undefined = source.UndefinedValue;
                source.SetException(source.CreateTypeError("Must call as a constructor."));
                return undefined;
            }

            var dlg = new MessageDialog(args.First().ToString());
            return source.Converter.FromWindowsRuntimeObject(dlg);
        }
Beispiel #14
0
        private IJavaScriptValue EchoForNoNamespace(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
        {
            string arg = args.First().ToString();

            Assert.AreEqual("callback completed", arg);
            successSignal.SetResult(0);
            return source.UndefinedValue;
        }
Beispiel #15
0
 private IJavaScriptValue Failure(JavaScriptEngine source, bool construct, IJavaScriptValue thisValue, IEnumerable<IJavaScriptValue> args)
 {
     Assert.Fail();
     return source.UndefinedValue;
 }