public ProgressOperationControl(ProgressOperationsManager manager, ProgressOperation operation)
        {
            this.Tag                  = operation;
            this.Operation            = operation;
            this.manager              = manager;
            this.Height               = 2;
            messageAndOperationsPanel = Add(new StackPanel()
            {
                Orientation = Orientation.Vertical
            }).Fill();

            messageLabel = messageAndOperationsPanel.Add(new Label()
            {
                Mode = LabelRenderMode.ManualSizing
            }).FillHorizontally();
            messageLabel.CanFocus = true;

            messageLabel.KeyInputReceived.SubscribeForLifetime((k) =>
            {
                if (k.Key == ConsoleKey.Enter)
                {
                    var msg = operation.Message;
                    if (operation.Details != null)
                    {
                        msg += "\n" + operation.Details;
                    }
                    Dialog.ShowMessage(msg);
                }
                else if (k.Key == ConsoleKey.Delete)
                {
                    var app = Application;
                    manager.Operations.Remove(operation);
                    app.FocusManager.TryMoveFocus();
                }
            }, this);


            actionPanel = messageAndOperationsPanel.Add(new StackPanel()
            {
                Orientation = Orientation.Horizontal, Height = 1, Margin = 2
            }).FillHorizontally(messageAndOperationsPanel);
            spinner = actionPanel.Add(new Spinner()
            {
                CanFocus = false
            });
            timeLabel = actionPanel.Add(new Label()
            {
                Mode = LabelRenderMode.SingleLineAutoSize, Text = operation.StartTime.ToFriendlyPastTimeStamp().ToConsoleString()
            });


            spinner.IsSpinning = operation.State == OperationState.InProgress;

            foreach (var action in operation.Actions)
            {
                BindActionToActionPanel(action);
            }

            AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this);
        }
Beispiel #2
0
 public FramerateControl(SpacetimePanel scene)
 {
     this.scene    = scene;
     this.AutoSize = true;
     nowControl    = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     sceneFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     renderFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     paintFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     sceneBusyPercentageLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     AddedToVisualTree.SubscribeForLifetime(SetupPolling, this);
 }
Beispiel #3
0
        public LineChart()
        {
            ViewModel = new LineChartViewModel();

            YAxisLeftOffset = 14;
            AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this.LifetimeManager);
            KeyInputReceived.SubscribeForLifetime(OnKeyInputReceived, this.LifetimeManager);
        }
Beispiel #4
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);
 }
Beispiel #5
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);
 }
Beispiel #6
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);
 }
 public FramerateControl(Scene scene)
 {
     this.scene    = scene;
     this.AutoSize = true;
     sceneFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHoriontally();
     renderFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHoriontally();
     paintFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHoriontally();
     AddedToVisualTree.SubscribeForLifetime(SetupPolling, this.LifetimeManager);
 }
Beispiel #8
0
        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);
        }
Beispiel #9
0
        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);
        }
Beispiel #10
0
 public FramerateControl(SpaceTimePanel scene)
 {
     this.scene    = scene;
     this.AutoSize = true;
     nowControl    = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     elementsControl = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     functionsControl = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     renderFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     paintFPSLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     sleepTimeLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     zeroSpinsLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     nonZeroSpinsLabel = Add(new Label()
     {
         Text = "".ToConsoleString()
     }).FillHorizontally();
     AddedToVisualTree.SubscribeForLifetime(SetupPolling, this);
 }
Beispiel #11
0
 public CpuAndMemoryChart()
 {
     InitSeries();
     InitAxes();
     AddedToVisualTree.SubscribeForLifetime(OnAddedToVisualTree, this);
 }
Beispiel #12
0
 public BreadcrumbBar()
 {
     this.Height   = 1;
     this.CanFocus = false;
     AddedToVisualTree.SubscribeForLifetime(Compose, this);
 }