Пример #1
0
 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);
 }
Пример #2
0
 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);
 }
Пример #3
0
 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);
 }