public ProgressOperationManagerControl(ProgressOperationsManager manager) { this.manager = manager; this.scrollablePanel = Add(new ScrollablePanel()).Fill(); operationsStackPanel = scrollablePanel.ScrollableContent.Add(new StackPanel() { Orientation = Orientation.Vertical, AutoSize=true }).FillHoriontally(); noNotificationsLabel = Add(new Label() { Text = "No notifications".ToConsoleString(), X=1, Y=1 }); manager.Operations.SynchronizeForLifetime(Operations_Added, Operations_Removed, Operations_Changed, this.LifetimeManager); }
public GridPage() { CommandBar = Add(new CommandBar() { Y = 1 }); filterLabel = Add(new Label() { Y = 2, Text = "Filter:".ToConsoleString(), Width = "Filter:".Length }); FilterTextBox = Add(new TextBox() { Y = 2, X = filterLabel.Text.Length }); Grid = Add(new Grid() { Y = 3 }); Grid.FilterTextBox = FilterTextBox; }
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 }).FillHoriontally(); 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.LifetimeManager); actionPanel = messageAndOperationsPanel.Add(new StackPanel() { Orientation = Orientation.Horizontal, Height = 1, Margin = 2 }).FillHoriontally(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.LifetimeManager); }