public IAsyncOperation <IUICommand> ShowAsync() { VisualTreeHelperProxy.CloseAllFlyouts(); var command = $"Uno.UI.WindowManager.current.alert(\"{Uno.Foundation.WebAssemblyRuntime.EscapeJs(Content)}\");"; Uno.Foundation.WebAssemblyRuntime.InvokeJS(command); return(AsyncOperation.FromTask <IUICommand>( async ct => new UICommand("OK") // TODO: Localize (PBI 28711) )); }
public IAsyncOperation <IUICommand> ShowAsync() { VisualTreeHelperProxy.CloseAllPopups(); var invokedCommand = new TaskCompletionSource <IUICommand>(); return(AsyncOperation.FromTask <IUICommand>(async ct => { if (CoreDispatcher.Main.HasThreadAccess) { try { ShowInner(ct, invokedCommand); } catch (Exception e) { invokedCommand.TrySetException(e); } } else { Exception ex = null; await CoreDispatcher.Main.RunAsync(CoreDispatcherPriority.Normal, CallShow); if (ex != null) { invokedCommand.TrySetException(ex); } void CallShow() { try { ShowInner(ct, invokedCommand); } catch (Exception e) { ex = e; } } } return await invokedCommand.Task; })); }
public IAsyncOperation <IUICommand> ShowAsync() { VisualTreeHelperProxy.CloseAllFlyouts(); return(AsyncOperation.FromTask <IUICommand>(async ct => { if (CoreDispatcher.Main.HasThreadAccess) { return await ShowInner(ct); } else { var show = default(Task <IUICommand>); await CoreDispatcher.Main.RunAsync(CoreDispatcherPriority.Normal, () => show = ShowInner(ct)); return await show; } })); }