/// <summary> /// Draw a drop shadow to the right and bottom of a given box /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="l">Left edge of box casting the shadow</param> /// <param name="t">Top edge of box casting the shadow</param> /// <param name="r">Right edge of box casting the shadow</param> /// <param name="b">Bottom edge of box casting the shadow</param> public static void DrawShadow(ConsoleTheme theme, int l, int t, int r, int b) { int w = r - l + 1; if (theme.PopupShadow.HasValue) { Console.BackgroundColor = theme.PopupShadow.Value; if (r < Console.WindowWidth - 2) { // Right shadow for (int y = t + 1; y <= b; ++y) { if (y >= 0 && y < Console.WindowHeight - 1) { Console.SetCursorPosition(r + 1, y); Console.Write(" "); } } } // Bottom shadow if (l + w + 2 > Console.WindowWidth) { w = Console.WindowWidth - l - 2; } if (b < Console.WindowHeight - 1) { Console.SetCursorPosition(l + 2, b + 1); Console.Write("".PadRight(w)); } } }
/// <summary> /// Draw a scrollbar for scrollable screen objects /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="r">X coordinate of scrollbar</param> /// <param name="t">Y coordinate of top of scrollbar</param> /// <param name="b">Y coordinate of bottom of scrollbar</param> /// <param name="dragRow">Y coordinate of the box indicating how scrolled the bar is</param> protected void DrawScrollbar(ConsoleTheme theme, int r, int t, int b, int dragRow) { Console.BackgroundColor = theme.ScrollBarBg; Console.ForegroundColor = theme.ScrollBarFg; for (int y = t; y <= b; ++y) { Console.SetCursorPosition(r, y); if (y <= t) { Console.Write(scrollUp); } else if (y == b) { Console.Write(scrollDown); } else if (y == dragRow) { Console.Write(scrollDrag); } else { Console.Write(scrollBar); } } }
/// <summary> /// Draw the text box /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">Framework parameter not relevant to this object</param> public override void Draw(ConsoleTheme theme, bool focused) { int l = GetLeft(); int h = GetBottom() - GetTop() + 1; int index = lines.Count < h ? 0 : topLine; // Chop one col off the right if we need a scrollbar int w = GetRight() - l + 1 + (lines.Count > h ? -1 : 0); if (getBgColor != null) { Console.BackgroundColor = getBgColor(theme); } else { Console.BackgroundColor = theme.TextBoxBg; } if (getFgColor != null) { Console.ForegroundColor = getFgColor(theme); } else { Console.ForegroundColor = theme.TextBoxFg; } for (int y = GetTop(); y <= GetBottom(); ++y, ++index) { Console.SetCursorPosition(l, y); if (index < lines.Count) { switch (align) { case TextAlign.Left: Console.Write(lines[index].PadRight(w)); break; case TextAlign.Center: Console.Write(ScreenObject.PadCenter(lines[index], w)); break; case TextAlign.Right: Console.Write(lines[index].PadLeft(w)); break; } } else { Console.Write("".PadRight(w)); } } // Scrollbar if (lines.Count > h) { DrawScrollbar( theme, GetRight(), GetTop(), GetBottom(), GetTop() + 1 + (h - 3) * topLine / (lines.Count - h) ); } }
/// <summary> /// Draw a frame /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">Framework parameter not relevant to this control</param> public override void Draw(ConsoleTheme theme, bool focused) { int l = GetLeft(), t = GetTop(), r = GetRight(), b = GetBottom(); int w = r - l + 1; Console.BackgroundColor = theme.MainBg; Console.ForegroundColor = getColor(theme); Console.SetCursorPosition(l, t); Console.Write(doubleBorder ? Symbols.upperLeftCornerDouble : Symbols.upperLeftCorner); writeTitleRow(getTopTitle(), w); Console.Write(doubleBorder ? Symbols.upperRightCornerDouble : Symbols.upperRightCorner); for (int y = t + 1; y <= b - 1; ++y) { Console.SetCursorPosition(l, y); if (y == middleRow) { Console.Write(doubleBorder ? Symbols.leftTeeDouble : Symbols.leftTee); writeTitleRow(getMidTitle(), w); Console.Write(doubleBorder ? Symbols.rightTeeDouble : Symbols.rightTee); } else { Console.Write(doubleBorder ? Symbols.vertLineDouble : Symbols.vertLine); Console.SetCursorPosition(r, y); Console.Write(doubleBorder ? Symbols.vertLineDouble : Symbols.vertLine); } } Console.SetCursorPosition(l, b); Console.Write(doubleBorder ? Symbols.lowerLeftCornerDouble : Symbols.lowerLeftCorner); Console.Write(new string(doubleBorder ? Symbols.horizLineDouble : Symbols.horizLine, w - 2)); Console.Write(doubleBorder ? Symbols.lowerRightCornerDouble : Symbols.lowerRightCorner); }
/// <summary> /// Draw the progress bar /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">Framework parameter not relevant to this object</param> public override void Draw(ConsoleTheme theme, bool focused) { int l = GetLeft(), t = GetTop(); int w = GetRight() - l + 1; double percent = percentFunc == null ? 0 : percentFunc(); int highlightWidth = (int)Math.Floor(w * percent); if (highlightWidth < 0) { highlightWidth = 0; } else if (highlightWidth > w) { highlightWidth = w; } // Build one big string representing the whole contents of the bar string caption = PadCenter(captionFunc == null ? "" : captionFunc(), w); Console.SetCursorPosition(l, t); // Draw the highlighted part if (highlightWidth > 0) { Console.BackgroundColor = theme.ProgressBarHighlightBg; Console.ForegroundColor = theme.ProgressBarHighlightFg; Console.Write(caption.Substring(0, highlightWidth)); } // Draw the non highlighted part Console.BackgroundColor = theme.ProgressBarBg; Console.ForegroundColor = theme.ProgressBarFg; Console.Write(caption.Substring(highlightWidth)); }
private void DrawSelectedHamburger(ConsoleTheme theme) { Console.SetCursorPosition(Console.WindowWidth - 3, 0); Console.BackgroundColor = theme.MenuSelectedBg; Console.ForegroundColor = theme.MenuFg; Console.Write(hamburger); }
/// <summary> /// Standard driver function for normal screen interaction. /// Draws the screen and reads keys till done. /// Each key is checked against the local bindings, /// then the bindings of the focused ScreenObject. /// Stops when 'done' is true. /// </summary> protected void Interact(ConsoleTheme theme) { focusIndex = -1; Blur(null, true); do { Draw(theme); ConsoleKeyInfo k = Console.ReadKey(true); if (bindings.ContainsKey(k)) { done = !bindings[k](this, theme); } else if (objects.Count > 0) { if (objects[focusIndex].Bindings.ContainsKey(k)) { done = !objects[focusIndex].Bindings[k](this, theme); } else { objects[focusIndex].OnKeyPress(k); } } } while (!done); }
/// <summary> /// Draw all the contained ScreenObjects. /// Also places the cursor where it should be. /// </summary> protected void Draw(ConsoleTheme theme) { lock (screenLock) { Console.CursorVisible = false; DrawFooter(theme); for (int i = 0; i < objects.Count; ++i) { objects[i].Draw(theme, i == focusIndex); } if (objects.Count > 0 && focusIndex >= 0 && focusIndex < objects.Count && objects[focusIndex].Focusable()) { objects[focusIndex].PlaceCursor(); Console.CursorVisible = true; } else { Console.CursorVisible = false; } } }
/// <summary> /// Draw the labelFunc /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">Framework parameter not relevant to this object</param> public override void Draw(ConsoleTheme theme, bool focused) { int w = GetRight() - GetLeft() + 1; Console.SetCursorPosition(GetLeft(), GetTop()); if (getBgColor == null) { Console.BackgroundColor = theme.LabelBg; } else { Console.BackgroundColor = getBgColor(theme); } if (getFgColor == null) { Console.ForegroundColor = theme.LabelFg; } else { Console.ForegroundColor = getFgColor(theme); } try { Console.Write(FormatExactWidth(labelFunc(), w)); } catch (Exception ex) { Console.Write(FormatExactWidth(ex.Message, w)); } }
/// <summary> /// Draw the button /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">True if button has the focus, false otherwise</param> public override void Draw(ConsoleTheme theme, bool focused) { int w = GetRight() - GetLeft() + 1; // Main button text Console.SetCursorPosition(GetLeft(), GetTop()); Console.BackgroundColor = theme.PopupButtonBg; if (focused) { Console.ForegroundColor = theme.PopupButtonSelectedFg; } else { Console.ForegroundColor = theme.PopupButtonFg; } Console.Write(ScreenObject.PadCenter(caption, w)); // Right shadow if (theme.PopupButtonShadow.HasValue) { Console.BackgroundColor = theme.PopupBg; Console.ForegroundColor = theme.PopupButtonShadow.Value; Console.Write(Symbols.lowerHalfBlock); // Bottom shadow Console.SetCursorPosition(GetLeft() + 1, GetTop() + 1); Console.Write(shadowStrip); } }
private void DrawFooter(ConsoleTheme theme) { Console.BackgroundColor = theme.FooterBg; Console.ForegroundColor = theme.FooterDescriptionFg; Console.SetCursorPosition(0, Console.WindowHeight - 1); Console.Write(" "); // Windows cmd.exe auto-scrolls the whole window if you draw a // character in the bottom right corner :( Console.Write((options[selectedOption]?.Tooltip ?? "").PadRight(Console.WindowWidth - Console.CursorLeft - 1)); }
/// <summary> /// Display the menu and handle its interactions /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="right">X coordinate of right edge of menu</param> /// <param name="top">Y coordinate of top edge of menu</param> /// <returns> /// Return value of menu option selected by user /// </returns> public bool Run(ConsoleTheme theme, int right, int top) { bool val = true; bool done = false; do { Draw(theme, right, top); ConsoleKeyInfo k = Console.ReadKey(true); switch (k.Key) { case ConsoleKey.UpArrow: do { selectedOption = (selectedOption + options.Count - 1) % options.Count; } while (options[selectedOption] == null || !options[selectedOption].Enabled); break; case ConsoleKey.DownArrow: do { selectedOption = (selectedOption + 1) % options.Count; } while (options[selectedOption] == null || !options[selectedOption].Enabled); break; case ConsoleKey.Enter: if (options[selectedOption].CloseParent) { done = true; } if (options[selectedOption].OnExec != null) { val = options[selectedOption].OnExec(theme); } if (options[selectedOption].SubMenu != null) { options[selectedOption].SubMenu.Run( theme, right - 2, top + selectedOption + 2 ); } break; case ConsoleKey.F10: case ConsoleKey.Escape: case ConsoleKey.Applications: done = true; break; } } while (!done); return(val); }
/// <summary> /// Set the whole screen to dark blue and draw the top header bar /// </summary> protected override void DrawBackground(ConsoleTheme theme) { // Cheat because our IUser handlers need a theme userTheme = theme; Console.BackgroundColor = theme.MainBg; Console.Clear(); Console.SetCursorPosition(0, 0); Console.BackgroundColor = theme.HeaderBg; Console.ForegroundColor = theme.HeaderFg; Console.Write(LeftCenterRight( " " + LeftHeader(), CenterHeader(), mainMenu != null ? hamburger : "", Console.WindowWidth )); }
/// <summary> /// Draw the outline of the dialog and clear the footer /// </summary> protected override void DrawBackground(ConsoleTheme theme) { int w = GetRight() - GetLeft() + 1; string fullHorizLineDouble = new string(Symbols.horizLineDouble, w - 2); string midSpace = new string(' ', w - 2); Console.BackgroundColor = theme.PopupBg; Console.ForegroundColor = theme.PopupOutlineFg; for (int y = GetTop(); y <= GetBottom(); ++y) { if (y < 0 || y >= Console.WindowHeight) { continue; } Console.SetCursorPosition(GetLeft(), y); if (y == GetTop()) { // Top row string curTitle = CenterHeader(); if (string.IsNullOrEmpty(curTitle)) { Console.Write(Symbols.upperLeftCornerDouble + fullHorizLineDouble + Symbols.upperRightCornerDouble); } else { // Title centered Console.Write(Symbols.upperLeftCornerDouble + ScreenObject.PadCenter($" {curTitle} ", w - 2, Symbols.horizLineDouble) + Symbols.upperRightCornerDouble); } } else if (y == GetBottom()) { // Bottom row Console.Write(Symbols.lowerLeftCornerDouble + fullHorizLineDouble + Symbols.lowerRightCornerDouble); } else { // Blank lines, mostly padding Console.Write(Symbols.vertLineDouble + midSpace + Symbols.vertLineDouble); } } DrawShadow(theme, GetLeft(), GetTop(), GetRight(), GetBottom()); }
/// <summary> /// Draw a frame /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">Framework parameter not relevant to this control</param> public override void Draw(ConsoleTheme theme, bool focused) { int l = GetLeft(), t = GetTop(), r = GetRight(), b = GetBottom(); int w = r - l + 1; string title = getTitle(); Console.BackgroundColor = theme.MainBg; Console.ForegroundColor = getColor(theme); Console.SetCursorPosition(l, t); Console.Write(doubleBorder ? Symbols.upperLeftCornerDouble : Symbols.upperLeftCorner); if (title.Length > 0) { int topLeftSidePad = (w - 4 - title.Length) / 2; int topRightSidePad = (w - 4 - title.Length) - topLeftSidePad; if (topLeftSidePad < 0 || topRightSidePad < 0) { topLeftSidePad = 0; topRightSidePad = 0; title = title.Substring(0, w - 4); } Console.Write(new string(doubleBorder ? Symbols.horizLineDouble : Symbols.horizLine, topLeftSidePad)); Console.Write($" {title} "); Console.Write(new string(doubleBorder ? Symbols.horizLineDouble : Symbols.horizLine, topRightSidePad)); } else { Console.Write(new string(doubleBorder ? Symbols.horizLineDouble : Symbols.horizLine, w - 2)); } Console.Write(doubleBorder ? Symbols.upperRightCornerDouble : Symbols.upperRightCorner); for (int y = t + 1; y <= b - 1; ++y) { Console.SetCursorPosition(l, y); Console.Write(doubleBorder ? Symbols.vertLineDouble : Symbols.vertLine); Console.SetCursorPosition(r, y); Console.Write(doubleBorder ? Symbols.vertLineDouble : Symbols.vertLine); } Console.SetCursorPosition(l, b); Console.Write(doubleBorder ? Symbols.lowerLeftCornerDouble : Symbols.lowerLeftCorner); Console.Write(new string(doubleBorder ? Symbols.horizLineDouble : Symbols.horizLine, w - 2)); Console.Write(doubleBorder ? Symbols.lowerRightCornerDouble : Symbols.lowerRightCorner); }
/// <summary> /// Draw the contained screen objects and manage their interaction /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="process">Logic to drive the screen, default is normal user interaction</param> public virtual void Run(ConsoleTheme theme, Action <ConsoleTheme> process = null) { DrawBackground(theme); if (process == null) { // This should be a simple default parameter, but C# has trouble // with that for instance delegates. process = Interact; } else { // Other classes can't call Draw directly, so do it for them once. // Would be nice to make this cleaner somehow. Draw(theme); } // Run the actual logic for the container process(theme); ClearBackground(); }
/// <summary> /// Draw the field /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">If true, draw with focus, else without focus</param> public override void Draw(ConsoleTheme theme, bool focused) { int w = GetRight() - GetLeft() + 1; if (Position > Value.Length) { Position = Value.Length; } if (leftPos > Position) { leftPos = Position; } if (leftPos < Position - w + 1) { leftPos = Position - w + 1; } Console.SetCursorPosition(GetLeft(), GetTop()); Console.BackgroundColor = theme.FieldBg; if (string.IsNullOrEmpty(Value)) { Console.ForegroundColor = theme.FieldGhostFg; Console.Write(GhostText().PadRight(w)); } else { if (focused) { Console.ForegroundColor = theme.FieldFocusedFg; } else { Console.ForegroundColor = theme.FieldBlurredFg; } Console.Write(FormatExactWidth(Value.Substring(leftPos), w)); } }
/// <summary> /// Draw the basic background elements of the display. /// Called once at the beginning and then again later if we need to reset the display. /// NOT called every tick, to reduce flickering. /// </summary> protected virtual void DrawBackground(ConsoleTheme theme) { }
/// <summary> /// Launch a screen and then clean up after it so we can continue using this screen. /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="cs">Subscreen to launch</param> /// <param name="newProc">Function to drive the screen, default is normal interaction</param> protected void LaunchSubScreen(ConsoleTheme theme, ConsoleScreen cs, Action <ConsoleTheme> newProc = null) { cs.Run(theme, newProc); DrawBackground(theme); Draw(theme); }
/// <summary> /// Display the dialog and handle its interaction /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="process">Function to control the dialog, default is normal user interaction</param> /// <returns> /// Row user selected /// </returns> public new ChoiceT Run(ConsoleTheme theme, Action <ConsoleTheme> process = null) { base.Run(theme, process); return(cancelled ? default(ChoiceT) : choices.Selection); }
private void DrawFooter(ConsoleTheme theme) { Console.SetCursorPosition(0, Console.WindowHeight - 1); Console.BackgroundColor = theme.FooterBg; Console.Write(" "); var tipLists = new List <List <ScreenTip> >() { tips }; if (objects.Count > 0) { tipLists.Add(objects[focusIndex].Tips); } bool first = true; foreach (var tipList in tipLists) { for (int i = 0; i < tipList.Count; ++i) { if (tipList[i].DisplayIf()) { if (Console.CursorLeft + tipSeparator.Length + tipList[i].Key.Length + 5 > Console.WindowWidth) { // Stop drawing if not even enough room for the key break; } if (first) { first = false; } else { Console.ForegroundColor = theme.FooterSeparatorFg; Console.Write(tipSeparator); } Console.ForegroundColor = theme.FooterKeyFg; Console.Write(tipList[i].Key); Console.ForegroundColor = theme.FooterDescriptionFg; string remainder; if (tipList[i].Key == tipList[i].Description.Substring(0, 1)) { remainder = tipList[i].Description.Substring(1); } else { remainder = $" - {tipList[i].Description}"; } int maxW = Console.WindowWidth - Console.CursorLeft - 1; if (remainder.Length > maxW && maxW > 0) { Console.Write(remainder.Substring(0, maxW)); } else { Console.Write(remainder); } } } } // Windows cmd.exe auto-scrolls the whole window if you draw a // character in the bottom right corner :( Console.Write("".PadLeft(Console.WindowWidth - Console.CursorLeft - 1)); }
private void Draw(ConsoleTheme theme, int right, int top) { if (options.Count > 0) { right = Formatting.ConvertCoord(right, Console.WindowWidth); top = Formatting.ConvertCoord(top, Console.WindowHeight); Console.CursorVisible = false; // Space, vertical line, space, options, space, vertical line, space int w = longestLength + 6; // Horizontal lines before and after the options int h = options.Count + 2; Console.BackgroundColor = theme.MenuBg; Console.ForegroundColor = theme.MenuFg; string fullHorizLine = new string(Symbols.horizLine, longestLength + 2); for (int index = -1, y = top; y < top + h; ++index, ++y) { Console.SetCursorPosition(right - w + 1, y); // Left padding Console.Write(" "); if (index < 0) { // Draw top line Console.Write(Symbols.upperLeftCorner + fullHorizLine + Symbols.upperRightCorner); } else if (index >= options.Count) { // Draw bottom line Console.Write(Symbols.lowerLeftCorner + fullHorizLine + Symbols.lowerRightCorner); } else { ConsoleMenuOption opt = options[index]; if (opt == null) { // Draw separator Console.Write(Symbols.leftTee + fullHorizLine + Symbols.rightTee); } else { // Draw menu option Console.Write(Symbols.vertLine); if (!opt.Enabled) { Console.ForegroundColor = theme.MenuDisabledFg; } if (index == selectedOption) { // Draw highlighted menu option Console.BackgroundColor = theme.MenuSelectedBg; Console.Write(" " + AnnotatedCaption(opt) + " "); Console.BackgroundColor = theme.MenuBg; } else { // Draw normal menu option Console.Write(" " + AnnotatedCaption(opt) + " "); } if (!opt.Enabled) { Console.ForegroundColor = theme.MenuFg; } Console.Write(Symbols.vertLine); } } // Right padding Console.Write(" "); } ConsoleDialog.DrawShadow(theme, right - w + 1, top, right, top + h - 1); DrawFooter(theme); Console.SetCursorPosition(right - longestLength - 3, top + selectedOption + 1); Console.CursorVisible = true; } }
/// <summary> /// Draw the list box /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">Framework parameter not relevant to this object</param> public override void Draw(ConsoleTheme theme, bool focused) { int l = GetLeft(), r = GetRight(), t = GetTop(), b = GetBottom(), h = b - t + 1; bool needScrollbar = (sortedFilteredData.Count >= h); int contentR = needScrollbar ? r - 1 : r; // Prevent selection from running off the end of the list if (selectedRow > sortedFilteredData.Count - 1) { selectedRow = sortedFilteredData.Count - 1; } // Ensure selection is not before the top of the list if (selectedRow < 0) { selectedRow = 0; } // Don't scroll past the bottom of the list if (topRow > sortedFilteredData.Count - h + 1) { topRow = sortedFilteredData.Count - h + 1; } // Don't scroll before the top of the list if (topRow < 0) { topRow = 0; } if (topRow > selectedRow) { // Scroll up to reveal selected row topRow = selectedRow; } else if (topRow < selectedRow - h + 2) { // Scroll down to reveal selected row topRow = selectedRow - h + 2; } for (int y = 0, index = topRow - 1; y < h; ++y, ++index) { Console.SetCursorPosition(l, t + y); if (y == 0) { Console.BackgroundColor = theme.ListBoxHeaderBg; Console.ForegroundColor = theme.ListBoxHeaderFg; Console.Write(" "); for (int i = 0; i < columns.Count; ++i) { ConsoleListBoxColumn <RowT> col = columns[i]; if (i > 0) { Console.Write(" "); } // Truncate to designated size of the ListBox int maxW = r - Console.CursorLeft + 1; if (maxW > 0) { Console.Write(FmtHdr( i, col.Width < maxW ? col.Width : maxW )); } } } else if (index >= 0 && index < sortedFilteredData.Count) { if (topRow + y - 1 == selectedRow) { Console.BackgroundColor = theme.ListBoxSelectedBg; Console.ForegroundColor = theme.ListBoxSelectedFg; } else { Console.BackgroundColor = theme.ListBoxUnselectedBg; Console.ForegroundColor = theme.ListBoxUnselectedFg; } Console.Write(" "); for (int i = 0; i < columns.Count; ++i) { ConsoleListBoxColumn <RowT> col = columns[i]; if (i > 0) { Console.Write(" "); } // Truncate to designated size of the ListBox int maxW = contentR - Console.CursorLeft + 1; if (maxW > 0) { Console.Write(FormatExactWidth( col.Renderer(sortedFilteredData[index]).Trim(), col.Width < maxW ? col.Width : maxW )); } } } else { Console.BackgroundColor = theme.ListBoxUnselectedBg; Console.ForegroundColor = theme.ListBoxUnselectedFg; } try { if (y == 0) { Console.Write("".PadRight(r - Console.CursorLeft + 1)); } else { // Make space for scrollbar for anti-flicker Console.Write("".PadRight(contentR - Console.CursorLeft + 1)); } } catch { } } // Now draw the scrollbar if (needScrollbar) { DrawScrollbar( theme, r, t + scrollTop, b, sortedFilteredData.Count > 0 ? t + 1 + scrollTop + (h - 2 - scrollTop) * selectedRow / sortedFilteredData.Count : -1 ); } }
/// <summary> /// Display the dialog and handle its interaction /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="process">Function to control the dialog, default is normal user interaction</param> /// <returns> /// Files user selected /// </returns> public new HashSet <FileInfo> Run(ConsoleTheme theme, Action <ConsoleTheme> process = null) { base.Run(theme, process); return(chosenFiles); }
/// <summary> /// Draw the UI element /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="focused">If true, draw with focus, else draw without focused</param> public abstract void Draw(ConsoleTheme theme, bool focused);
/// <summary> /// Show the dialog and handle its interaction /// </summary> /// <param name="theme">The visual theme to use to draw the dialog</param> /// <param name="process">Function to control the dialog, default is normal user interaction</param> /// <returns> /// Index of button the user pressed /// </returns> public new int Run(ConsoleTheme theme, Action <ConsoleTheme> process = null) { base.Run(theme, process); return(selectedButton); }