public override async void CanExecuteCommand(params IJavascriptObject[] e) { var parameter = _JavascriptToCSharpConverter.GetFirstArgumentOrNull(e); var res = await UiDispatcher.EvaluateAsync(() => _Command.CanExecute(parameter)); UpdateCanExecuteValue(res); }
private async void ComputeCanExecute() { var res = await UiDispatcher.EvaluateAsync(() => _Command.CanExecute); if (res == _CanExecute) { return; } _CanExecute = res; UpdateCanExecuteValue(res); }
public override async void CanExecuteCommand(params IJavascriptObject[] e) { var parameter = _JavascriptToCSharpConverter.GetFirstArgument <T>(e); if (!parameter.Success) { Logger.Error($"Impossible to call CanExecuteCommand on command<{typeof(T)}>, no matching argument found, received:{parameter.TentativeValue} of type:{parameter.TentativeValue?.GetType()} expectedType: {typeof(T)}"); return; } var res = await UiDispatcher.EvaluateAsync(() => _Command.CanExecute(parameter.Value)); UpdateCanExecuteValue(res); }
public async void Execute(IJavascriptObject[] arguments) { var promise = GetPromise(arguments); var argument = GetArgumentValueOnJsContext(arguments); if (!argument.Success) { return; } try { await await UiDispatcher.EvaluateAsync(async() => { var res = await ExecuteOnUiThread(argument.Value); _CSharpUnrootedObjectManager.RegisterInSession(res, bridge => SetResult(promise, bridge)); }); } catch (Exception exception) { SetError(promise, exception).DoNotWait(); } }
public Task <T> EvaluateOnUiContextAsync <T>(Func <T> act) { return(UiDispatcher.EvaluateAsync(act)); }