public Page() { CanFocus = false; ProgressOperationManager = ProgressOperationsManager.Default; RemovedFromVisualTree.SubscribeForLifetime(Page_Removed, this.LifetimeManager); BreadcrumbBar = Add(new BreadcrumbBar()); SynchronizeForLifetime(nameof(Bounds), () => { BreadcrumbBar.Width = Width; }, this.LifetimeManager); }
/// <summary> /// Shows the dialog on top of the current app /// </summary> /// <returns>a promise that resolves when this dialog is dismissed. This promise never rejects.</returns> private Promise Show() { ConsoleApp.AssertAppThread(); var deferred = Deferred.Create(); ConsoleApp.Current.LayoutRoot.Add(this); RemovedFromVisualTree.SubscribeForLifetime(deferred.Resolve, this); return(deferred.Promise); }
/// <summary> /// Shows the dialog on top of the current app /// </summary> /// <returns>a Task that resolves when this dialog is dismissed. This Task never rejects.</returns> private Task Show() { ConsoleApp.AssertAppThread(); var deferred = new TaskCompletionSource <bool>(); ConsoleApp.Current.LayoutRoot.Add(this); RemovedFromVisualTree.SubscribeForLifetime(() => deferred.SetResult(true), this); return(deferred.Task); }
public Dialog(ConsoleControl content) { Add(content).Fill(padding: new Thickness(0, 0, 1, 1)); closeButton = Add(new Button() { Text = "Close (ESC)", Background = Theme.DefaultTheme.H1Color, Foreground = ConsoleColor.Black }).DockToRight(padding: 1); closeButton.Activated.SubscribeForLifetime(Escape, this.LifetimeManager); BeforeAddedToVisualTree.SubscribeForLifetime(OnBeforeAddedToVisualTree, this.LifetimeManager); AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this.LifetimeManager); RemovedFromVisualTree.SubscribeForLifetime(OnRemovedFromVisualTree, this.LifetimeManager); }
private Dialog(DialogOptions options) { this.options = options; Add(options.GetContent()).Fill(padding: new Thickness(0, 0, 1, 1)); closeButton = Add(new Button() { Text = "Close (ESC)".ToConsoleString(), Background = DefaultColors.H1Color, Foreground = ConsoleColor.Black }).DockToRight(padding: 1); closeButton.Pressed.SubscribeForLifetime(Escape, this); BeforeAddedToVisualTree.SubscribeForLifetime(OnBeforeAddedToVisualTree, this); AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this); RemovedFromVisualTree.SubscribeForLifetime(OnRemovedFromVisualTree, this); }
public Dialog(ConsoleControl content) { Add(content).Fill(padding: new Thickness(0, 0, 1, 1)); AllowEscapeToCancel = true; closeButton = Add(new Button() { Text = "Close (ESC)".ToConsoleString(), Background = DefaultColors.H1Color, Foreground = ConsoleColor.Black }).DockToRight(padding: 1); closeButton.Pressed.SubscribeForLifetime(Escape, this); BeforeAddedToVisualTree.SubscribeForLifetime(OnBeforeAddedToVisualTree, this); AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this); RemovedFromVisualTree.SubscribeForLifetime(OnRemovedFromVisualTree, this); }
public ScrollablePanel() { ScrollableContent = Add(new ConsolePanel() { IsVisible = false }).Fill(); verticalScrollbar = Add(new Scrollbar(Orientation.Vertical) { Width = 1 }).DockToRight(); horizontalScrollbar = Add(new Scrollbar(Orientation.Horizontal) { Height = 1 }).DockToBottom(); AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this.LifetimeManager); RemovedFromVisualTree.SubscribeForLifetime(OnRemovedFromVisualTree, this.LifetimeManager); }
public ScrollablePanel() { ScrollableContent = Add(new ConsolePanel() { IsVisible = true }).Fill(); SynchronizeForLifetime(nameof(Background), () => ScrollableContent.Background = Background, this); verticalScrollbar = Add(new Scrollbar(Orientation.Vertical) { Width = 1 }).DockToRight(); horizontalScrollbar = Add(new Scrollbar(Orientation.Horizontal) { Height = 1 }).DockToBottom(); AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this); RemovedFromVisualTree.SubscribeForLifetime(OnRemovedFromVisualTree, this); }
/// <summary> /// Shows the dialog on top of the current app /// </summary> /// <returns>a Task that resolves when this dialog is dismissed. This Task never rejects.</returns> private Task Show() { ConsoleApp.AssertAppThread(); var deferred = new TaskCompletionSource <bool>(); ConsoleApp.Current.LayoutRoot.Add(this); RemovedFromVisualTree.SubscribeForLifetime(() => deferred.TrySetResult(true), this); if (options.AutoDismissTask != null) { ConsoleApp.Current.Invoke(async() => { await options.AutoDismissTask; this.TryDispose(); deferred.TrySetResult(true); }); } return(deferred.Task); }
internal void RemovedFromVisualTreeInternal() { RemovedFromVisualTree.Fire(); }