本文整理汇总了C#中IJavascriptObject类的典型用法代码示例。如果您正苦于以下问题:C# IJavascriptObject类的具体用法?C# IJavascriptObject怎么用?C# IJavascriptObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IJavascriptObject类属于命名空间,在下文中一共展示了IJavascriptObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: JsGenericObject
private JsGenericObject(HTMLViewContext context, IJavascriptObject value)
{
JSValue = value;
_MappedJSValue = value;
CValue = null;
_HTMLViewContext = context;
}
开发者ID:sjoerd222888,项目名称:MVVM.CEF.Glue,代码行数:7,代码来源:JsGenericObject.cs
示例2: VueJavascriptViewModelUpdater
public VueJavascriptViewModelUpdater(IWebView webView, IJavascriptObject listener, Lazy<IJavascriptObject> vueHelper, IWebSessionLogger logger)
{
_WebView = webView;
_Listener = listener;
_VueHelper = vueHelper;
_Logger = logger;
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:7,代码来源:VueJavascriptViewModelUpdater.cs
示例3: JSGenericObject
private JSGenericObject(IWebView context, IJavascriptObject value)
{
JSValue = value;
_MappedJSValue = value;
CValue = null;
_CefV8Context = context;
}
开发者ID:yovannyr,项目名称:MVVM.CEF.Glue,代码行数:7,代码来源:JSGenericObject.cs
示例4: RegisterCollectionMapping
internal void RegisterCollectionMapping(IJavascriptObject jsFather, string att, int index, IJavascriptObject child)
{
var father = GetGlobalCached(jsFather);
var jsos = (att == null) ? father : ((JsGenericObject)father).Attributes[att];
Update(((JSArray)jsos).Items[index] as IJSObservableBridge, child);
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:7,代码来源:SessionCacher.cs
示例5: SetResult
private void SetResult(IJavascriptObject[] e, IJSCBridgeCache bridge, Task<object> resulttask)
{
_IWebView.RunAsync (() =>
{
if (e.Length < 2)
return;
IJavascriptObject promise = e[1];
if (!resulttask.IsFaulted)
{
bridge.RegisterInSession(resulttask.Result, (bridgevalue) =>
{
promise.InvokeAsync("fullfill", _IWebView, bridgevalue.GetJSSessionValue());
});
}
else
{
string error = (resulttask.IsCanceled) ? "Cancelled" :
((resulttask.Exception == null) ? "Faulted" : resulttask.Exception.Flatten().InnerException.Message);
promise.InvokeAsync("reject", _IWebView, _IWebView.Factory.CreateString(error));
}
});
}
开发者ID:yovannyr,项目名称:MVVM.CEF.Glue,代码行数:25,代码来源:JSResultCommand.cs
示例6: MappNested
private void MappNested(object from, IJavascriptObject resobject, JsGenericObject gres)
{
if (from == null)
return;
var propertyInfos = from.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => p.CanRead);
foreach (var propertyInfo in propertyInfos)
{
var propertyName = propertyInfo.Name;
object childvalue;
try
{
childvalue = propertyInfo.GetValue(from, null);
}
catch(Exception e)
{
_Logger.Info(()=> $"Unable to convert property {propertyName} from {@from} exception {e}");
continue;
}
var childres = UnsafelMap(childvalue);
_Context.WebView.Run(() => resobject.SetValue(propertyName, childres.JSValue));
gres.UpdateCSharpProperty(propertyName, childres);
}
}
开发者ID:sjoerd222888,项目名称:MVVM.CEF.Glue,代码行数:26,代码来源:CSharpToJavascriptConverter.cs
示例7: SpliceCollection
public void SpliceCollection(IJavascriptObject array, int index, int number, IJavascriptObject added)
{
_WebView.RunAsync(() =>
{
AddUnsafe(array, index, number, added);
});
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:7,代码来源:VueJavascriptViewModelUpdater.cs
示例8: ClearAllCollection
public void ClearAllCollection(IJavascriptObject array)
{
_WebView.RunAsync(() =>
{
var length = array.GetArrayLength();
array.Invoke("silentSplice", _WebView, _WebView.Factory.CreateInt(0), _WebView.Factory.CreateInt(length));
});
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:8,代码来源:VueJavascriptViewModelUpdater.cs
示例9: LocalComputeJavascriptValue
protected override bool LocalComputeJavascriptValue(IJavascriptObjectFactory factory)
{
if (JSValue != null)
return false;
JSValue = factory.CreateObject(true);
return true;
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:8,代码来源:JsSimpleCommand.cs
示例10: MoveCollectionItem
public void MoveCollectionItem(IJavascriptObject array, IJavascriptObject item, int oldIndex, int newIndex)
{
_WebView.RunAsync(() =>
{
array.Invoke("silentSplice", _WebView, _WebView.Factory.CreateInt(oldIndex), _WebView.Factory.CreateInt(1));
AddUnsafe(array, newIndex, 0, item);
});
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:8,代码来源:VueJavascriptViewModelUpdater.cs
示例11: VueVmManager
public VueVmManager(IWebView webView, IJavascriptObject listener, IWebSessionLogger logger)
{
_WebView = webView;
_Logger = logger;
_VueHelperLazy = new Lazy<IJavascriptObject>(GetVueHelper);
_VueJavascriptSessionInjector = new VueJavascriptSessionInjector(webView, listener, _VueHelperLazy, _Logger);
_VueJavascriptViewModelUpdater = new VueJavascriptViewModelUpdater(webView, listener, _VueHelperLazy, _Logger);
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:8,代码来源:VueVmManager.cs
示例12: JavascriptColectionChanged
private void JavascriptColectionChanged(IJavascriptObject[] arguments)
{
var values = arguments[1].GetArrayElements();
var types = arguments[2].GetArrayElements();
var indexes = arguments[3].GetArrayElements();
var collectionChange = new JavascriptCollectionChanges(arguments[0], values.Zip(types, indexes, (v, t, i) => new IndividualJavascriptCollectionChange(t.GetStringValue() == "added" ? CollectionChangeType.Add : CollectionChangeType.Remove, i.GetIntValue(), v)));
_Observer.OnJavaScriptCollectionChanges(collectionChange);
}
开发者ID:sjoerd222888,项目名称:MVVM.CEF.Glue,代码行数:9,代码来源:BinderBuilder.cs
示例13: RegisterMapping
internal void RegisterMapping(IJavascriptObject father, string att, IJavascriptObject child)
{
var global = GetGlobalCached(father);
if (global is JSCommand)
return;
var jso = (JsGenericObject)global;
Update(jso.Attributes[att] as IJSObservableBridge, child);
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:9,代码来源:SessionCacher.cs
示例14: CanExecuteCommand
private async void CanExecuteCommand(IJavascriptObject[] e)
{
var parameter = _JavascriptToCSharpConverter.GetFirstArgumentOrNull(e);
var res = await UIDispatcher.EvaluateAsync(() => _Command.CanExecute(parameter));
await WebView.RunAsync(() =>
{
UpdateProperty("CanExecuteValue", (f) => f.CreateBool(res));
});
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:9,代码来源:JSCommand.cs
示例15: LocalComputeJavascriptValue
protected override bool LocalComputeJavascriptValue(IJavascriptObjectFactory factory)
{
if (JSValue != null)
return false;
JSValue = factory.CreateObject(true);
JSValue.SetValue("CanExecuteValue", factory.CreateBool(_InitialCanExecute));
JSValue.SetValue("CanExecuteCount", factory.CreateInt(_Count));
return true;
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:10,代码来源:JSCommand.cs
示例16: GetSimpleValue
public bool GetSimpleValue(IJavascriptObject decoratedValue, out object res, Type iTargetType = null)
{
res = null;
var value = decoratedValue.Convert();
if ((value.IsUndefined) || (value.IsNull))
{
return true;
}
if (value.IsString)
{
res = value.StringValue;
return true;
}
if (value.IsBool)
{
res = value.BoolValue;
return true;
}
if (iTargetType.IsUnsigned())
{
if (value.IsUint)
res = value.UintValue;
}
else
{
if (value.IsInt)
res = value.IntValue;
}
if ((res == null) && (value.IsDouble))
{
res = value.DoubleValue;
}
if (res != null)
{
if (iTargetType != null)
res = Convert.ChangeType(res, iTargetType);
return true;
}
if (value.IsDate)
{
res = value.DateValue.ToUniversalTime(value.DateValue);
return true;
}
return false;
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:54,代码来源:ChromiumFXConverter.cs
示例17: GetSimpleValue
public bool GetSimpleValue(IJavascriptObject ijsvalue, out object res, Type iTargetType = null)
{
res = null;
CefV8Value value = CefV8_JavascriptObject.Convert(ijsvalue);
if ((value.IsUndefined) || (value.IsNull))
{
return true;
}
if (value.IsString)
{
res = ijsvalue.GetStringValue();
return true;
}
if (value.IsBool)
{
res = value.GetBoolValue();
return true;
}
if (IsUnsigned(iTargetType))
{
if (value.IsUInt)
res = value.GetUIntValue();
}
else
{
if (value.IsInt)
res = value.GetIntValue();
}
if ((res == null) && (value.IsDouble))
{
res = value.GetDoubleValue();
}
if (res != null)
{
if (iTargetType != null)
res = Convert.ChangeType(res, iTargetType);
return true;
}
if (value.IsDate)
{
res = value.GetDateValue();
return true;
}
return false;
}
开发者ID:yovannyr,项目名称:MVVM.CEF.Glue,代码行数:54,代码来源:CefV8_Converter.cs
示例18: SetError
private async Task SetError(IJavascriptObject promise, Exception exception)
{
if (promise == null)
return;
await WebView.RunAsync(async () =>
{
var errormessage = exception?.Message ?? "Faulted";
await promise.InvokeAsync("reject", WebView, WebView.Factory.CreateString(errormessage));
});
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:11,代码来源:JsResultCommand.cs
示例19: UpdateCSharpProperty
public void UpdateCSharpProperty(string PropertyName, IJSCBridgeCache converter, IJavascriptObject newValue)
{
PropertyInfo propertyInfo = CValue.GetType().GetProperty(PropertyName, BindingFlags.Public | BindingFlags.Instance);
if (!propertyInfo.CanWrite)
return;
var type = propertyInfo.PropertyType.GetUnderlyingNullableType() ?? propertyInfo.PropertyType;
IJSCSGlue glue = converter.GetCachedOrCreateBasic(newValue, type);
_Attributes[PropertyName] = glue;
propertyInfo.SetValue(CValue, glue.CValue, null);
}
开发者ID:yovannyr,项目名称:MVVM.CEF.Glue,代码行数:11,代码来源:JSGenericObject.cs
示例20: SetResult
private async Task SetResult(IJavascriptObject promise, object result)
{
if (promise == null)
return;
await WebView.RunAsync(async () =>
{
var bridgevalue = await _JavascriptToCSharpConverter.RegisterInSession(result);
await promise.InvokeAsync("fullfill", WebView, bridgevalue.GetJSSessionValue());
});
}
开发者ID:David-Desmaisons,项目名称:MVVM.CEF.Glue,代码行数:11,代码来源:JsResultCommand.cs
注:本文中的IJavascriptObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论