From 239191cde095413addc5109de1b0bd4fc5e4347c Mon Sep 17 00:00:00 2001 From: BDisp Date: Sat, 18 Dec 2021 13:33:40 +0000 Subject: [PATCH] Fixes #1434. Regenerating the docs. (#1528) * Fixes #1434. Regenerating the docs. * Fixing warnings on docs regeneration and improving. --- UICatalog/Scenario.cs | 13 +- UICatalog/Scenarios/AllViewsTester.cs | 4 +- .../Scenarios/AutoSizeAndDirectionText.cs | 4 +- .../Scenarios/BackgroundWorkerCollection.cs | 4 +- UICatalog/Scenarios/BasicColors.cs | 4 +- UICatalog/Scenarios/Borders.cs | 4 +- UICatalog/Scenarios/BordersComparisons.cs | 4 +- UICatalog/Scenarios/BordersOnFrameView.cs | 4 +- UICatalog/Scenarios/BordersOnToplevel.cs | 4 +- UICatalog/Scenarios/BordersOnWindow.cs | 4 +- UICatalog/Scenarios/Buttons.cs | 4 +- UICatalog/Scenarios/CharacterMap.cs | 4 +- UICatalog/Scenarios/ClassExplorer.cs | 2 +- UICatalog/Scenarios/Clipping.cs | 4 +- UICatalog/Scenarios/ComputedLayout.cs | 4 +- UICatalog/Scenarios/Dialogs.cs | 4 +- UICatalog/Scenarios/DynamicMenuBar.cs | 2016 +++++------ UICatalog/Scenarios/DynamicStatusBar.cs | 1052 +++--- UICatalog/Scenarios/Editor.cs | 4 +- UICatalog/Scenarios/Generic.cs | 4 +- UICatalog/Scenarios/GraphViewExample.cs | 2 +- UICatalog/Scenarios/HexEditor.cs | 4 +- UICatalog/Scenarios/InteractiveTree.cs | 2 +- UICatalog/Scenarios/InvertColors.cs | 4 +- UICatalog/Scenarios/Keys.cs | 4 +- UICatalog/Scenarios/LabelsAsButtons.cs | 4 +- UICatalog/Scenarios/LineViewExample.cs | 2 +- UICatalog/Scenarios/ListViewWithSelection.cs | 4 +- UICatalog/Scenarios/ListsAndCombos.cs | 2 +- UICatalog/Scenarios/MessageBoxes.cs | 4 +- UICatalog/Scenarios/Mouse.cs | 4 +- UICatalog/Scenarios/Notepad.cs | 2 +- UICatalog/Scenarios/Progress.cs | 4 +- UICatalog/Scenarios/ProgressBarStyles.cs | 4 +- UICatalog/Scenarios/Scrolling.cs | 4 +- UICatalog/Scenarios/SendKeys.cs | 4 +- UICatalog/Scenarios/SingleBackgroundWorker.cs | 4 +- UICatalog/Scenarios/SyntaxHighlighting.cs | 2 +- UICatalog/Scenarios/SystemConsole.cs | 4 +- UICatalog/Scenarios/TabViewExample.cs | 2 +- UICatalog/Scenarios/Text.cs | 4 +- UICatalog/Scenarios/TextAlignments.cs | 4 +- .../Scenarios/TextAlignmentsAndDirection.cs | 4 +- UICatalog/Scenarios/TextFormatterDemo.cs | 4 +- UICatalog/Scenarios/Threading.cs | 4 +- UICatalog/Scenarios/TimeAndDate.cs | 4 +- UICatalog/Scenarios/TopLevelNoWindowBug.cs | 4 +- UICatalog/Scenarios/TreeUseCases.cs | 2 +- UICatalog/Scenarios/TreeViewFileSystem.cs | 2 +- UICatalog/Scenarios/Unicode.cs | 4 +- UICatalog/Scenarios/WindowsAndFrameViews.cs | 4 +- UICatalog/UICatalog.cs | 4 +- docfx/articles/index.md | 4 +- docfx/articles/keyboard.md | 2 +- docfx/articles/mainloop.md | 6 +- docfx/articles/overview.md | 37 +- docfx/articles/tableview.md | 2 +- docfx/articles/treeview.md | 2 +- docfx/docfx.json | 7 +- docfx/index.md | 8 +- docfx/runbuild.cmd | 1 + docs/README.html | 6 +- ...inal.Gui.Application.ResizedEventArgs.html | 10 +- .../Terminal.Gui.Application.RunState.html | 12 +- .../Terminal.Gui.Application.html | 70 +- .../Terminal.Gui/Terminal.Gui.Attribute.html | 28 +- .../Terminal.Gui.Autocomplete.html | 38 +- ...Terminal.Gui.Border.ToplevelContainer.html | 24 +- .../api/Terminal.Gui/Terminal.Gui.Border.html | 46 +- .../Terminal.Gui.BorderStyle.html | 6 +- .../api/Terminal.Gui/Terminal.Gui.Button.html | 32 +- .../Terminal.Gui/Terminal.Gui.CheckBox.html | 34 +- .../Terminal.Gui/Terminal.Gui.Clipboard.html | 14 +- .../Terminal.Gui.ClipboardBase.html | 20 +- docs/api/Terminal.Gui/Terminal.Gui.Color.html | 6 +- .../Terminal.Gui.ColorScheme.html | 26 +- .../api/Terminal.Gui/Terminal.Gui.Colors.html | 18 +- .../Terminal.Gui/Terminal.Gui.ComboBox.html | 42 +- ...nal.Gui.ConsoleDriver.DiagnosticFlags.html | 6 +- .../Terminal.Gui.ConsoleDriver.html | 146 +- .../Terminal.Gui.CursorVisibility.html | 6 +- .../Terminal.Gui/Terminal.Gui.DateField.html | 24 +- .../Terminal.Gui.DateTimeEventArgs-1.html | 14 +- .../api/Terminal.Gui/Terminal.Gui.Dialog.html | 16 +- docs/api/Terminal.Gui/Terminal.Gui.Dim.html | 26 +- .../Terminal.Gui.DisplayModeLayout.html | 6 +- .../Terminal.Gui.FakeConsole.html | 186 +- .../Terminal.Gui/Terminal.Gui.FakeDriver.html | 74 +- .../Terminal.Gui.FakeMainLoop.html | 18 +- .../Terminal.Gui/Terminal.Gui.FileDialog.html | 38 +- .../Terminal.Gui/Terminal.Gui.FrameView.html | 32 +- .../Terminal.Gui/Terminal.Gui.GraphView.html | 42 +- .../Terminal.Gui.Graphs.Axis.html | 32 +- ...inal.Gui.Graphs.AxisIncrementToRender.html | 14 +- .../Terminal.Gui.Graphs.BarSeries.Bar.html | 14 +- .../Terminal.Gui.Graphs.BarSeries.html | 24 +- ...Terminal.Gui.Graphs.GraphCellToRender.html | 16 +- .../Terminal.Gui.Graphs.HorizontalAxis.html | 18 +- .../Terminal.Gui.Graphs.IAnnotation.html | 10 +- .../Terminal.Gui.Graphs.ISeries.html | 8 +- ...rminal.Gui.Graphs.LabelGetterDelegate.html | 6 +- .../Terminal.Gui.Graphs.LegendAnnotation.html | 18 +- .../Terminal.Gui.Graphs.MultiBarSeries.html | 16 +- .../Terminal.Gui.Graphs.Orientation.html | 6 +- ...minal.Gui.Graphs.PathAnnotation.LineF.html | 12 +- .../Terminal.Gui.Graphs.PathAnnotation.html | 16 +- .../Terminal.Gui.Graphs.ScatterSeries.html | 12 +- .../Terminal.Gui.Graphs.TextAnnotation.html | 18 +- .../Terminal.Gui.Graphs.VerticalAxis.html | 18 +- .../api/Terminal.Gui/Terminal.Gui.Graphs.html | 6 +- .../Terminal.Gui/Terminal.Gui.HexView.html | 30 +- .../Terminal.Gui/Terminal.Gui.IClipboard.html | 16 +- .../Terminal.Gui.IListDataSource.html | 18 +- .../Terminal.Gui.IMainLoopDriver.html | 14 +- .../Terminal.Gui/Terminal.Gui.ITreeView.html | 12 +- docs/api/Terminal.Gui/Terminal.Gui.Key.html | 6 +- .../Terminal.Gui/Terminal.Gui.KeyEvent.html | 28 +- .../Terminal.Gui.KeyModifiers.html | 18 +- docs/api/Terminal.Gui/Terminal.Gui.Label.html | 24 +- .../Terminal.Gui.LayoutStyle.html | 6 +- .../Terminal.Gui/Terminal.Gui.ListView.html | 78 +- .../Terminal.Gui.ListViewItemEventArgs.html | 12 +- .../Terminal.Gui.ListWrapper.html | 20 +- .../Terminal.Gui/Terminal.Gui.MainLoop.html | 28 +- .../Terminal.Gui/Terminal.Gui.MenuBar.html | 52 +- .../Terminal.Gui.MenuBarItem.html | 24 +- .../Terminal.Gui/Terminal.Gui.MenuItem.html | 36 +- .../Terminal.Gui.MenuItemCheckStyle.html | 6 +- .../Terminal.Gui.MenuOpeningEventArgs.html | 14 +- .../Terminal.Gui/Terminal.Gui.MessageBox.html | 308 +- .../Terminal.Gui/Terminal.Gui.MouseEvent.html | 20 +- .../Terminal.Gui/Terminal.Gui.MouseFlags.html | 6 +- .../Terminal.Gui.OpenDialog.OpenMode.html | 6 +- .../Terminal.Gui/Terminal.Gui.OpenDialog.html | 18 +- .../Terminal.Gui/Terminal.Gui.PanelView.html | 22 +- docs/api/Terminal.Gui/Terminal.Gui.Point.html | 42 +- .../api/Terminal.Gui/Terminal.Gui.PointF.html | 44 +- docs/api/Terminal.Gui/Terminal.Gui.Pos.html | 32 +- .../Terminal.Gui.ProgressBar.html | 28 +- .../Terminal.Gui.ProgressBarFormat.html | 6 +- .../Terminal.Gui.ProgressBarStyle.html | 6 +- ...ui.RadioGroup.SelectedItemChangedArgs.html | 12 +- .../Terminal.Gui/Terminal.Gui.RadioGroup.html | 40 +- docs/api/Terminal.Gui/Terminal.Gui.Rect.html | 70 +- .../Terminal.Gui/Terminal.Gui.RectangleF.html | 74 +- .../Terminal.Gui/Terminal.Gui.Responder.html | 44 +- .../Terminal.Gui/Terminal.Gui.SaveDialog.html | 12 +- .../Terminal.Gui.ScrollBarView.html | 44 +- .../Terminal.Gui/Terminal.Gui.ScrollView.html | 46 +- .../Terminal.Gui.ShortcutHelper.html | 28 +- docs/api/Terminal.Gui/Terminal.Gui.Size.html | 38 +- docs/api/Terminal.Gui/Terminal.Gui.SizeF.html | 48 +- .../Terminal.Gui.StackExtensions.html | 20 +- .../Terminal.Gui/Terminal.Gui.StatusBar.html | 28 +- .../Terminal.Gui/Terminal.Gui.StatusItem.html | 14 +- .../Terminal.Gui.TabView.Tab.html | 14 +- ...minal.Gui.TabView.TabChangedEventArgs.html | 12 +- .../Terminal.Gui.TabView.TabStyle.html | 12 +- .../Terminal.Gui/Terminal.Gui.TabView.html | 42 +- ....Gui.TableView.CellActivatedEventArgs.html | 14 +- ...nal.Gui.TableView.CellColorGetterArgs.html | 18 +- ...Gui.TableView.CellColorGetterDelegate.html | 6 +- .../Terminal.Gui.TableView.ColumnStyle.html | 24 +- ...inal.Gui.TableView.RowColorGetterArgs.html | 10 +- ....Gui.TableView.RowColorGetterDelegate.html | 6 +- ...ableView.SelectedCellChangedEventArgs.html | 18 +- ...Terminal.Gui.TableView.TableSelection.html | 12 +- .../Terminal.Gui.TableView.TableStyle.html | 28 +- .../Terminal.Gui/Terminal.Gui.TableView.html | 78 +- .../Terminal.Gui.TextAlignment.html | 6 +- .../Terminal.Gui.TextChangingEventArgs.html | 12 +- .../Terminal.Gui.TextDirection.html | 6 +- .../Terminal.Gui/Terminal.Gui.TextField.html | 62 +- .../Terminal.Gui.TextFormatter.html | 68 +- .../Terminal.Gui.TextValidateField.html | 24 +- ...lidateProviders.ITextValidateProvider.html | 28 +- ...lidateProviders.NetMaskedTextProvider.html | 32 +- ...xtValidateProviders.TextRegexProvider.html | 34 +- .../Terminal.Gui.TextValidateProviders.html | 6 +- .../Terminal.Gui/Terminal.Gui.TextView.html | 120 +- .../Terminal.Gui/Terminal.Gui.Thickness.html | 18 +- .../Terminal.Gui/Terminal.Gui.TimeField.html | 24 +- .../Terminal.Gui/Terminal.Gui.Toplevel.html | 84 +- ...Terminal.Gui.ToplevelClosingEventArgs.html | 12 +- .../Terminal.Gui.ToplevelComparer.html | 8 +- ...Terminal.Gui.ToplevelEqualityComparer.html | 10 +- .../Terminal.Gui/Terminal.Gui.TreeView-1.html | 114 +- .../Terminal.Gui/Terminal.Gui.TreeView.html | 8 +- ...inal.Gui.Trees.AspectGetterDelegate-1.html | 6 +- ...minal.Gui.Trees.DelegateTreeBuilder-1.html | 14 +- .../Terminal.Gui.Trees.ITreeBuilder-1.html | 12 +- .../Terminal.Gui.Trees.ITreeNode.html | 12 +- ....Gui.Trees.ObjectActivatedEventArgs-1.html | 12 +- ...Gui.Trees.SelectionChangedEventArgs-1.html | 14 +- .../Terminal.Gui.Trees.TreeBuilder-1.html | 14 +- .../Terminal.Gui.Trees.TreeNode.html | 18 +- .../Terminal.Gui.Trees.TreeNodeBuilder.html | 10 +- .../Terminal.Gui.Trees.TreeStyle.html | 18 +- docs/api/Terminal.Gui/Terminal.Gui.Trees.html | 6 +- .../Terminal.Gui.VerticalTextAlignment.html | 6 +- .../Terminal.Gui.View.FocusEventArgs.html | 12 +- .../Terminal.Gui.View.KeyEventEventArgs.html | 12 +- .../Terminal.Gui.View.LayoutEventArgs.html | 8 +- .../Terminal.Gui.View.MouseEventArgs.html | 12 +- docs/api/Terminal.Gui/Terminal.Gui.View.html | 240 +- .../Terminal.Gui.Views.LineView.html | 20 +- docs/api/Terminal.Gui/Terminal.Gui.Views.html | 6 +- .../api/Terminal.Gui/Terminal.Gui.Window.html | 34 +- docs/api/Terminal.Gui/Terminal.Gui.html | 6 +- .../Unix.Terminal.Curses.Event.html | 6 +- .../Unix.Terminal.Curses.MouseEvent.html | 16 +- .../Unix.Terminal.Curses.Window.html | 48 +- .../Terminal.Gui/Unix.Terminal.Curses.html | 412 +-- docs/api/Terminal.Gui/Unix.Terminal.html | 6 +- .../UICatalog/UICatalog.NumberToWords.html | 10 +- .../UICatalog.Scenario.ScenarioCategory.html | 14 +- .../UICatalog.Scenario.ScenarioMetadata.html | 16 +- docs/api/UICatalog/UICatalog.Scenario.html | 88 +- .../UICatalog.Scenarios.AllViewsTester.html | 247 ++ ...og.Scenarios.AutoSizeAndDirectionText.html | 211 ++ ....Scenarios.BackgroundWorkerCollection.html | 243 ++ .../UICatalog.Scenarios.BasicColors.html | 211 ++ .../UICatalog.Scenarios.Borders.html | 211 ++ ...ICatalog.Scenarios.BordersComparisons.html | 240 ++ ...ICatalog.Scenarios.BordersOnFrameView.html | 211 ++ ...UICatalog.Scenarios.BordersOnToplevel.html | 211 ++ .../UICatalog.Scenarios.BordersOnWindow.html | 211 ++ .../UICatalog.Scenarios.Buttons.html | 212 ++ .../UICatalog.Scenarios.CharacterMap.html | 225 ++ .../UICatalog.Scenarios.ClassExplorer.html | 211 ++ .../UICatalog.Scenarios.Clipping.html | 240 ++ .../UICatalog.Scenarios.ComputedLayout.html | 222 ++ .../UICatalog.Scenarios.CsvEditor.html | 8 +- .../UICatalog.Scenarios.Dialogs.html | 212 ++ ...log.Scenarios.DynamicMenuBar.Binding.html} | 54 +- ...DynamicMenuBar.DynamicMenuBarDetails.html} | 148 +- ....DynamicMenuBar.DynamicMenuBarSample.html} | 44 +- ...arios.DynamicMenuBar.DynamicMenuItem.html} | 138 +- ...s.DynamicMenuBar.DynamicMenuItemList.html} | 54 +- ....DynamicMenuBar.DynamicMenuItemModel.html} | 62 +- ...arios.DynamicMenuBar.IValueConverter.html} | 24 +- ....DynamicMenuBar.ListWrapperConverter.html} | 32 +- ...DynamicMenuBar.UStringValueConverter.html} | 32 +- .../UICatalog.Scenarios.DynamicMenuBar.html | 233 ++ ...og.Scenarios.DynamicStatusBar.Binding.html | 296 ++ ...micStatusBar.DynamicStatusBarDetails.html} | 126 +- ...amicStatusBar.DynamicStatusBarSample.html} | 56 +- ...s.DynamicStatusBar.DynamicStatusItem.html} | 64 +- ...namicStatusBar.DynamicStatusItemList.html} | 54 +- ...amicStatusBar.DynamicStatusItemModel.html} | 54 +- ...rios.DynamicStatusBar.IValueConverter.html | 173 + ...DynamicStatusBar.ListWrapperConverter.html | 210 ++ ...ynamicStatusBar.UStringValueConverter.html | 210 ++ .../UICatalog.Scenarios.DynamicStatusBar.html | 233 ++ .../UICatalog/UICatalog.Scenarios.Editor.html | 244 ++ .../UICatalog.Scenarios.GraphViewExample.html | 211 ++ .../UICatalog.Scenarios.HexEditor.html | 215 ++ .../UICatalog.Scenarios.InteractiveTree.html | 211 ++ .../UICatalog.Scenarios.InvertColors.html | 211 ++ .../UICatalog/UICatalog.Scenarios.Keys.html | 240 ++ .../UICatalog.Scenarios.LabelsAsLabels.html | 212 ++ .../UICatalog.Scenarios.LineViewExample.html | 211 ++ ...talog.Scenarios.ListViewWithSelection.html | 323 ++ .../UICatalog.Scenarios.ListsAndCombos.html | 211 ++ .../UICatalog.Scenarios.MessageBoxes.html | 212 ++ .../UICatalog/UICatalog.Scenarios.Mouse.html | 211 ++ ...ICatalog.Scenarios.MultiColouredTable.html | 8 +- .../UICatalog.Scenarios.MyScenario.html | 211 ++ .../UICatalog.Scenarios.Notepad.html | 242 ++ .../UICatalog.Scenarios.Progress.html | 237 ++ ...UICatalog.Scenarios.ProgressBarStyles.html | 212 ++ .../UICatalog.Scenarios.Scrolling.html | 212 ++ .../UICatalog.Scenarios.SendKeys.html | 211 ++ ...narios.SingleBackgroundWorker.MainApp.html | 601 ++++ ...eBackgroundWorker.StagingUIController.html | 637 ++++ ...alog.Scenarios.SingleBackgroundWorker.html | 214 ++ ...ICatalog.Scenarios.SyntaxHighlighting.html | 211 ++ .../UICatalog.Scenarios.TabViewExample.html | 211 ++ .../UICatalog.Scenarios.TableEditor.html | 12 +- .../UICatalog/UICatalog.Scenarios.Text.html | 212 ++ .../UICatalog.Scenarios.TextAlignments.html | 211 ++ ...Scenarios.TextAlignmentsAndDirections.html | 211 ++ ...UICatalog.Scenarios.TextFormatterDemo.html | 212 ++ .../UICatalog.Scenarios.Threading.html | 211 ++ .../UICatalog.Scenarios.TimeAndDate.html | 212 ++ ...Catalog.Scenarios.TopLevelNoWindowBug.html | 211 ++ .../UICatalog.Scenarios.TreeUseCases.html | 211 ++ ...ICatalog.Scenarios.TreeViewFileSystem.html | 211 ++ .../UICatalog.Scenarios.UnicodeInMenu.html | 212 ++ .../UICatalog.Scenarios.UseSystemConsole.html | 255 ++ ...atalog.Scenarios.WindowsAndFrameViews.html | 256 ++ docs/api/UICatalog/UICatalog.Scenarios.html | 158 +- .../api/UICatalog/UICatalog.UICatalogApp.html | 6 +- docs/api/UICatalog/UICatalog.html | 38 +- docs/api/UICatalog/toc.html | 252 +- docs/articles/index.html | 6 +- docs/articles/keyboard.html | 6 +- docs/articles/mainloop.html | 10 +- docs/articles/overview.html | 41 +- docs/articles/tableview.html | 8 +- docs/articles/treeview.html | 8 +- docs/articles/views.html | 6 +- docs/index.html | 14 +- docs/index.json | 430 ++- docs/manifest.json | 1379 ++++++-- docs/styles/docfx.vendor.css | 497 +-- docs/styles/docfx.vendor.js | 53 +- docs/styles/lunr.min.js | 2 +- docs/xrefmap.yml | 3056 ++++++++++++----- 309 files changed, 20064 insertions(+), 8317 deletions(-) create mode 100644 docfx/runbuild.cmd create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.AllViewsTester.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.AutoSizeAndDirectionText.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.BackgroundWorkerCollection.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.BasicColors.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Borders.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.BordersComparisons.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.BordersOnFrameView.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.BordersOnToplevel.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.BordersOnWindow.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Buttons.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.CharacterMap.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.ClassExplorer.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Clipping.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.ComputedLayout.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Dialogs.html rename docs/api/UICatalog/{UICatalog.Binding.html => UICatalog.Scenarios.DynamicMenuBar.Binding.html} (78%) rename docs/api/UICatalog/{UICatalog.DynamicMenuBarDetails.html => UICatalog.Scenarios.DynamicMenuBar.DynamicMenuBarDetails.html} (85%) rename docs/api/UICatalog/{UICatalog.DynamicMenuBarSample.html => UICatalog.Scenarios.DynamicMenuBar.DynamicMenuBarSample.html} (92%) rename docs/api/UICatalog/{UICatalog.DynamicMenuItem.html => UICatalog.Scenarios.DynamicMenuBar.DynamicMenuItem.html} (77%) rename docs/api/UICatalog/{UICatalog.DynamicMenuItemList.html => UICatalog.Scenarios.DynamicMenuBar.DynamicMenuItemList.html} (77%) rename docs/api/UICatalog/{UICatalog.DynamicMenuItemModel.html => UICatalog.Scenarios.DynamicMenuBar.DynamicMenuItemModel.html} (76%) rename docs/api/UICatalog/{UICatalog.IValueConverter.html => UICatalog.Scenarios.DynamicMenuBar.IValueConverter.html} (86%) rename docs/api/UICatalog/{UICatalog.ListWrapperConverter.html => UICatalog.Scenarios.DynamicMenuBar.ListWrapperConverter.html} (82%) rename docs/api/UICatalog/{UICatalog.UStringValueConverter.html => UICatalog.Scenarios.DynamicMenuBar.UStringValueConverter.html} (82%) create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.DynamicMenuBar.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.DynamicStatusBar.Binding.html rename docs/api/UICatalog/{UICatalog.DynamicStatusBarDetails.html => UICatalog.Scenarios.DynamicStatusBar.DynamicStatusBarDetails.html} (86%) rename docs/api/UICatalog/{UICatalog.DynamicStatusBarSample.html => UICatalog.Scenarios.DynamicStatusBar.DynamicStatusBarSample.html} (90%) rename docs/api/UICatalog/{UICatalog.DynamicStatusItem.html => UICatalog.Scenarios.DynamicStatusBar.DynamicStatusItem.html} (76%) rename docs/api/UICatalog/{UICatalog.DynamicStatusItemList.html => UICatalog.Scenarios.DynamicStatusBar.DynamicStatusItemList.html} (76%) rename docs/api/UICatalog/{UICatalog.DynamicStatusItemModel.html => UICatalog.Scenarios.DynamicStatusBar.DynamicStatusItemModel.html} (77%) create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.DynamicStatusBar.IValueConverter.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.DynamicStatusBar.ListWrapperConverter.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.DynamicStatusBar.UStringValueConverter.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.DynamicStatusBar.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Editor.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.GraphViewExample.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.HexEditor.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.InteractiveTree.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.InvertColors.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Keys.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.LabelsAsLabels.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.LineViewExample.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.ListViewWithSelection.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.ListsAndCombos.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.MessageBoxes.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Mouse.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.MyScenario.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Notepad.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Progress.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.ProgressBarStyles.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Scrolling.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.SendKeys.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.SingleBackgroundWorker.MainApp.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.SingleBackgroundWorker.StagingUIController.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.SingleBackgroundWorker.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.SyntaxHighlighting.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TabViewExample.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Text.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TextAlignments.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TextAlignmentsAndDirections.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TextFormatterDemo.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.Threading.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TimeAndDate.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TopLevelNoWindowBug.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TreeUseCases.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.TreeViewFileSystem.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.UnicodeInMenu.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.UseSystemConsole.html create mode 100644 docs/api/UICatalog/UICatalog.Scenarios.WindowsAndFrameViews.html diff --git a/UICatalog/Scenario.cs b/UICatalog/Scenario.cs index 4592112ae..2338334bd 100644 --- a/UICatalog/Scenario.cs +++ b/UICatalog/Scenario.cs @@ -11,10 +11,10 @@ namespace UICatalog { /// To define a new scenario: /// /// Create a new .cs file in the Scenarios directory that derives from . - /// Annotate the derived class with a attribute specifying the scenario's name and description. - /// Add one or more attributes to the class specifying which categories the sceanrio belongs to. If you don't specify a category the sceanrio will show up in "All". + /// Annotate the derived class with a attribute specifying the scenario's name and description. + /// Add one or more attributes to the class specifying which categories the scenario belongs to. If you don't specify a category the scenario will show up in "All". /// Implement the override which will be called when a user selects the scenario to run. - /// Optionally, implement the and/or overrides to provide a custom implementation. + /// Optionally, implement the and/or overrides to provide a custom implementation. /// /// /// @@ -61,16 +61,16 @@ namespace UICatalog { /// Helper that provides the default implementation with a frame and /// label showing the name of the and logic to exit back to /// the Scenario picker UI. - /// Override to provide any behavior needed. + /// Override to provide any behavior needed. /// /// The Toplevel created by the UI Catalog host. /// The colorscheme to use. /// /// - /// Thg base implementation calls , sets to the passed in , creates a for and adds it to . + /// The base implementation calls , sets to the passed in , creates a for and adds it to . /// /// - /// Overrides that do not call the base., must call before creating any views or calling other Terminal.Gui APIs. + /// Overrides that do not call the base., must call before creating any views or calling other Terminal.Gui APIs. /// /// public virtual void Init(Toplevel top, ColorScheme colorScheme) @@ -177,7 +177,6 @@ namespace UICatalog { /// list of category names public List GetCategories () => ScenarioCategory.GetCategories (this.GetType ()); - /// public override string ToString () => $"{GetName (),-30}{GetDescription ()}"; /// diff --git a/UICatalog/Scenarios/AllViewsTester.cs b/UICatalog/Scenarios/AllViewsTester.cs index 0cc2bf3d3..91060aeb3 100644 --- a/UICatalog/Scenarios/AllViewsTester.cs +++ b/UICatalog/Scenarios/AllViewsTester.cs @@ -8,10 +8,10 @@ using System.Reflection; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "All Views Tester", Description: "Provides a test UI for all classes derived from View")] [ScenarioCategory ("Layout")] - class AllViewsTester : Scenario { + public class AllViewsTester : Scenario { Window _leftPane; ListView _classListView; FrameView _hostPane; diff --git a/UICatalog/Scenarios/AutoSizeAndDirectionText.cs b/UICatalog/Scenarios/AutoSizeAndDirectionText.cs index c173ee0d3..e036cb45e 100644 --- a/UICatalog/Scenarios/AutoSizeAndDirectionText.cs +++ b/UICatalog/Scenarios/AutoSizeAndDirectionText.cs @@ -1,9 +1,9 @@ using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "AutoSize and Direction Text", Description: "Demonstrates the text auto-size and direction manipulation.")] [ScenarioCategory ("Text")] - class AutoSizeAndDirectionText : Scenario { + public class AutoSizeAndDirectionText : Scenario { public override void Setup () { var text = "Hello World"; diff --git a/UICatalog/Scenarios/BackgroundWorkerCollection.cs b/UICatalog/Scenarios/BackgroundWorkerCollection.cs index 0cc30f211..02923e146 100644 --- a/UICatalog/Scenarios/BackgroundWorkerCollection.cs +++ b/UICatalog/Scenarios/BackgroundWorkerCollection.cs @@ -5,13 +5,13 @@ using System.Threading; using System.Threading.Tasks; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "BackgroundWorker Collection", Description: "A persisting multi Toplevel BackgroundWorker threading")] [ScenarioCategory ("Threading")] [ScenarioCategory ("TopLevel")] [ScenarioCategory ("Dialogs")] [ScenarioCategory ("Controls")] - class BackgroundWorkerCollection : Scenario { + public class BackgroundWorkerCollection : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { Application.Top.Dispose (); diff --git a/UICatalog/Scenarios/BasicColors.cs b/UICatalog/Scenarios/BasicColors.cs index aa3328c4b..ad2e62f5d 100644 --- a/UICatalog/Scenarios/BasicColors.cs +++ b/UICatalog/Scenarios/BasicColors.cs @@ -1,9 +1,9 @@ using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Basic Colors", Description: "Show all basic colors.")] [ScenarioCategory ("Colors")] - class BasicColors : Scenario { + public class BasicColors : Scenario { public override void Setup () { var vx = 30; diff --git a/UICatalog/Scenarios/Borders.cs b/UICatalog/Scenarios/Borders.cs index e5f6ebe08..30dd8743c 100644 --- a/UICatalog/Scenarios/Borders.cs +++ b/UICatalog/Scenarios/Borders.cs @@ -3,10 +3,10 @@ using System.Globalization; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Borders with/without PanelView", Description: "Demonstrate with/without PanelView borders manipulation.")] [ScenarioCategory ("Border")] - class Borders : Scenario { + public class Borders : Scenario { public override void Setup () { var borderStyle = BorderStyle.Single; diff --git a/UICatalog/Scenarios/BordersComparisons.cs b/UICatalog/Scenarios/BordersComparisons.cs index 988f41b41..d7c0a97d8 100644 --- a/UICatalog/Scenarios/BordersComparisons.cs +++ b/UICatalog/Scenarios/BordersComparisons.cs @@ -1,9 +1,9 @@ using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Borders Comparisons", Description: "Compares Window, Toplevel and FrameView borders.")] [ScenarioCategory ("Border")] - class BordersComparisons : Scenario { + public class BordersComparisons : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { top.Dispose (); diff --git a/UICatalog/Scenarios/BordersOnFrameView.cs b/UICatalog/Scenarios/BordersOnFrameView.cs index bd4838b73..18ae946af 100644 --- a/UICatalog/Scenarios/BordersOnFrameView.cs +++ b/UICatalog/Scenarios/BordersOnFrameView.cs @@ -3,10 +3,10 @@ using System.Globalization; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Borders on FrameView", Description: "Demonstrate FrameView borders manipulation.")] [ScenarioCategory ("Border")] - class BordersOnFrameView : Scenario { + public class BordersOnFrameView : Scenario { public override void Setup () { var borderStyle = BorderStyle.Double; diff --git a/UICatalog/Scenarios/BordersOnToplevel.cs b/UICatalog/Scenarios/BordersOnToplevel.cs index 6ee1de308..f5a836988 100644 --- a/UICatalog/Scenarios/BordersOnToplevel.cs +++ b/UICatalog/Scenarios/BordersOnToplevel.cs @@ -3,10 +3,10 @@ using System.Globalization; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Borders on Toplevel", Description: "Demonstrate Toplevel borders manipulation.")] [ScenarioCategory ("Border")] - class BordersOnToplevel : Scenario { + public class BordersOnToplevel : Scenario { public override void Setup () { var borderStyle = BorderStyle.Double; diff --git a/UICatalog/Scenarios/BordersOnWindow.cs b/UICatalog/Scenarios/BordersOnWindow.cs index 2b96ffb65..f29a5b1a6 100644 --- a/UICatalog/Scenarios/BordersOnWindow.cs +++ b/UICatalog/Scenarios/BordersOnWindow.cs @@ -3,10 +3,10 @@ using System.Globalization; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Borders on Window", Description: "Demonstrate Window borders manipulation.")] [ScenarioCategory ("Border")] - class BordersOnWindow : Scenario { + public class BordersOnWindow : Scenario { public override void Setup () { var borderStyle = BorderStyle.Double; diff --git a/UICatalog/Scenarios/Buttons.cs b/UICatalog/Scenarios/Buttons.cs index 16062bc3c..663980ba8 100644 --- a/UICatalog/Scenarios/Buttons.cs +++ b/UICatalog/Scenarios/Buttons.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Reflection; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Buttons", Description: "Demonstrates all sorts of Buttons")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Layout")] - class Buttons : Scenario { + public class Buttons : Scenario { public override void Setup () { // Add a label & text field so we can demo IsDefault diff --git a/UICatalog/Scenarios/CharacterMap.cs b/UICatalog/Scenarios/CharacterMap.cs index 10736add2..b7e3fa31e 100644 --- a/UICatalog/Scenarios/CharacterMap.cs +++ b/UICatalog/Scenarios/CharacterMap.cs @@ -8,7 +8,7 @@ using System.Text; using Terminal.Gui; using Rune = System.Rune; -namespace UICatalog { +namespace UICatalog.Scenarios { /// /// This Scenario demonstrates building a custom control (a class deriving from View) that: /// - Provides a simple "Character Map" application (like Windows' charmap.exe). @@ -18,7 +18,7 @@ namespace UICatalog { [ScenarioMetadata (Name: "Character Map", Description: "Illustrates a custom control and Unicode")] [ScenarioCategory ("Text")] [ScenarioCategory ("Controls")] - class CharacterMap : Scenario { + public class CharacterMap : Scenario { CharMap _charMap; public override void Setup () { diff --git a/UICatalog/Scenarios/ClassExplorer.cs b/UICatalog/Scenarios/ClassExplorer.cs index d5bc118ab..be2b2ae36 100644 --- a/UICatalog/Scenarios/ClassExplorer.cs +++ b/UICatalog/Scenarios/ClassExplorer.cs @@ -11,7 +11,7 @@ namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Class Explorer", Description: "Tree view explorer for classes by namespace based on TreeView")] [ScenarioCategory ("Controls")] - class ClassExplorer : Scenario { + public class ClassExplorer : Scenario { private TreeView treeView; private TextView textView; private MenuItem miShowPrivate; diff --git a/UICatalog/Scenarios/Clipping.cs b/UICatalog/Scenarios/Clipping.cs index 00cf263af..a0950a0b4 100644 --- a/UICatalog/Scenarios/Clipping.cs +++ b/UICatalog/Scenarios/Clipping.cs @@ -1,11 +1,11 @@ using System; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Clipping", Description: "Used to test that things clip correctly")] [ScenarioCategory ("Bug Repro")] - class Clipping : Scenario { + public class Clipping : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { diff --git a/UICatalog/Scenarios/ComputedLayout.cs b/UICatalog/Scenarios/ComputedLayout.cs index 2789a8a92..c8c1d0d5d 100644 --- a/UICatalog/Scenarios/ComputedLayout.cs +++ b/UICatalog/Scenarios/ComputedLayout.cs @@ -6,7 +6,7 @@ using System.Reflection; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { /// /// This Scenario demonstrates how to use Termina.gui's Dim and Pos Layout System. /// [x] - Using Dim.Fill to fill a window @@ -15,7 +15,7 @@ namespace UICatalog { /// [ScenarioMetadata (Name: "Computed Layout", Description: "Demonstrates using the Computed (Dim and Pos) Layout System")] [ScenarioCategory ("Layout")] - class ComputedLayout : Scenario { + public class ComputedLayout : Scenario { public override void Setup () { diff --git a/UICatalog/Scenarios/Dialogs.cs b/UICatalog/Scenarios/Dialogs.cs index 8dcdeb693..da5ac994b 100644 --- a/UICatalog/Scenarios/Dialogs.cs +++ b/UICatalog/Scenarios/Dialogs.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Dialogs", Description: "Demonstrates how to the Dialog class")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Dialogs")] - class Dialogs : Scenario { + public class Dialogs : Scenario { public override void Setup () { var frame = new FrameView ("Dialog Options") { diff --git a/UICatalog/Scenarios/DynamicMenuBar.cs b/UICatalog/Scenarios/DynamicMenuBar.cs index 4b0c1bfa8..9a981855f 100644 --- a/UICatalog/Scenarios/DynamicMenuBar.cs +++ b/UICatalog/Scenarios/DynamicMenuBar.cs @@ -8,1114 +8,1114 @@ using System.Runtime.CompilerServices; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Dynamic MenuBar", Description: "Demonstrates how to add and remove a MenuBar, Menus and change titles dynamically.")] [ScenarioCategory ("Dynamic")] - class DynamicMenuBar : Scenario { + public class DynamicMenuBar : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { Application.Init (); Top = Application.Top; Top.Add (new DynamicMenuBarSample ($"CTRL-Q to Close - Scenario: {GetName ()}")); } - } - public class DynamicMenuItemList { - public ustring Title { get; set; } - public MenuItem MenuItem { get; set; } + public class DynamicMenuItemList { + public ustring Title { get; set; } + public MenuItem MenuItem { get; set; } - public DynamicMenuItemList () { } + public DynamicMenuItemList () { } - public DynamicMenuItemList (ustring title, MenuItem menuItem) - { - Title = title; - MenuItem = menuItem; + public DynamicMenuItemList (ustring title, MenuItem menuItem) + { + Title = title; + MenuItem = menuItem; + } + + public override string ToString () => $"{Title}, {MenuItem}"; } - public override string ToString () => $"{Title}, {MenuItem}"; - } + public class DynamicMenuItem { + public ustring title = "_New"; + public ustring help = ""; + public ustring action = ""; + public bool isTopLevel; + public bool hasSubMenu; + public MenuItemCheckStyle checkStyle; + public ustring shortcut; - public class DynamicMenuItem { - public ustring title = "_New"; - public ustring help = ""; - public ustring action = ""; - public bool isTopLevel; - public bool hasSubMenu; - public MenuItemCheckStyle checkStyle; - public ustring shortcut; + public DynamicMenuItem () { } - public DynamicMenuItem () { } + public DynamicMenuItem (ustring title, bool hasSubMenu = false) + { + this.title = title; + this.hasSubMenu = hasSubMenu; + } - public DynamicMenuItem (ustring title, bool hasSubMenu = false) - { - this.title = title; - this.hasSubMenu = hasSubMenu; + public DynamicMenuItem (ustring title, ustring help, ustring action, bool isTopLevel, bool hasSubMenu, MenuItemCheckStyle checkStyle = MenuItemCheckStyle.NoCheck, ustring shortcut = null) + { + this.title = title; + this.help = help; + this.action = action; + this.isTopLevel = isTopLevel; + this.hasSubMenu = hasSubMenu; + this.checkStyle = checkStyle; + this.shortcut = shortcut; + } } - public DynamicMenuItem (ustring title, ustring help, ustring action, bool isTopLevel, bool hasSubMenu, MenuItemCheckStyle checkStyle = MenuItemCheckStyle.NoCheck, ustring shortcut = null) - { - this.title = title; - this.help = help; - this.action = action; - this.isTopLevel = isTopLevel; - this.hasSubMenu = hasSubMenu; - this.checkStyle = checkStyle; - this.shortcut = shortcut; - } - } + public class DynamicMenuBarSample : Window { + MenuBar _menuBar; + MenuItem _currentMenuBarItem; + int _currentSelectedMenuBar; + MenuItem _currentEditMenuBarItem; + ListView _lstMenus; - public class DynamicMenuBarSample : Window { - MenuBar _menuBar; - MenuItem _currentMenuBarItem; - int _currentSelectedMenuBar; - MenuItem _currentEditMenuBarItem; - ListView _lstMenus; + public DynamicMenuItemModel DataContext { get; set; } - public DynamicMenuItemModel DataContext { get; set; } + public DynamicMenuBarSample (ustring title) : base (title) + { + DataContext = new DynamicMenuItemModel (); - public DynamicMenuBarSample (ustring title) : base (title) - { - DataContext = new DynamicMenuItemModel (); + var _frmDelimiter = new FrameView ("Shortcut Delimiter:") { + X = Pos.Center (), + Y = 3, + Width = 25, + Height = 4 + }; - var _frmDelimiter = new FrameView ("Shortcut Delimiter:") { - X = Pos.Center (), - Y = 3, - Width = 25, - Height = 4 - }; + var _txtDelimiter = new TextField (MenuBar.ShortcutDelimiter.ToString ()) { + X = Pos.Center (), + Width = 2, + }; + _txtDelimiter.TextChanged += (_) => MenuBar.ShortcutDelimiter = _txtDelimiter.Text; + _frmDelimiter.Add (_txtDelimiter); - var _txtDelimiter = new TextField (MenuBar.ShortcutDelimiter.ToString ()) { - X = Pos.Center(), - Width = 2, - }; - _txtDelimiter.TextChanged += (_) => MenuBar.ShortcutDelimiter = _txtDelimiter.Text; - _frmDelimiter.Add (_txtDelimiter); + Add (_frmDelimiter); - Add (_frmDelimiter); + var _frmMenu = new FrameView ("Menus:") { + Y = 7, + Width = Dim.Percent (50), + Height = Dim.Fill () + }; - var _frmMenu = new FrameView ("Menus:") { - Y = 7, - Width = Dim.Percent (50), - Height = Dim.Fill () - }; + var _btnAddMenuBar = new Button ("Add a MenuBar") { + Y = 1, + }; + _frmMenu.Add (_btnAddMenuBar); - var _btnAddMenuBar = new Button ("Add a MenuBar") { - Y = 1, - }; - _frmMenu.Add (_btnAddMenuBar); + var _btnMenuBarUp = new Button ("^") { + X = Pos.Center () + }; + _frmMenu.Add (_btnMenuBarUp); - var _btnMenuBarUp = new Button ("^") { - X = Pos.Center () - }; - _frmMenu.Add (_btnMenuBarUp); + var _btnMenuBarDown = new Button ("v") { + X = Pos.Center (), + Y = Pos.Bottom (_btnMenuBarUp) + }; + _frmMenu.Add (_btnMenuBarDown); - var _btnMenuBarDown = new Button ("v") { - X = Pos.Center (), - Y = Pos.Bottom (_btnMenuBarUp) - }; - _frmMenu.Add (_btnMenuBarDown); + var _btnRemoveMenuBar = new Button ("Remove a MenuBar") { + Y = 1 + }; + _btnRemoveMenuBar.X = Pos.AnchorEnd () - (Pos.Right (_btnRemoveMenuBar) - Pos.Left (_btnRemoveMenuBar)); + _frmMenu.Add (_btnRemoveMenuBar); - var _btnRemoveMenuBar = new Button ("Remove a MenuBar") { - Y = 1 - }; - _btnRemoveMenuBar.X = Pos.AnchorEnd () - (Pos.Right (_btnRemoveMenuBar) - Pos.Left (_btnRemoveMenuBar)); - _frmMenu.Add (_btnRemoveMenuBar); + var _btnPrevious = new Button ("<") { + X = Pos.Left (_btnAddMenuBar), + Y = Pos.Top (_btnAddMenuBar) + 2 + }; + _frmMenu.Add (_btnPrevious); - var _btnPrevious = new Button ("<") { - X = Pos.Left (_btnAddMenuBar), - Y = Pos.Top (_btnAddMenuBar) + 2 - }; - _frmMenu.Add (_btnPrevious); + var _btnAdd = new Button (" Add ") { + Y = Pos.Top (_btnPrevious) + 2, + }; + _btnAdd.X = Pos.AnchorEnd () - (Pos.Right (_btnAdd) - Pos.Left (_btnAdd)); + _frmMenu.Add (_btnAdd); - var _btnAdd = new Button (" Add ") { - Y = Pos.Top (_btnPrevious) + 2, - }; - _btnAdd.X = Pos.AnchorEnd () - (Pos.Right (_btnAdd) - Pos.Left (_btnAdd)); - _frmMenu.Add (_btnAdd); + var _btnNext = new Button (">") { + X = Pos.X (_btnAdd), + Y = Pos.Top (_btnPrevious), + }; + _frmMenu.Add (_btnNext); - var _btnNext = new Button (">") { - X = Pos.X (_btnAdd), - Y = Pos.Top (_btnPrevious), - }; - _frmMenu.Add (_btnNext); + var _lblMenuBar = new Label () { + ColorScheme = Colors.Dialog, + TextAlignment = TextAlignment.Centered, + X = Pos.Right (_btnPrevious) + 1, + Y = Pos.Top (_btnPrevious), + Width = Dim.Fill () - Dim.Width (_btnAdd) - 1, + Height = 1 + }; + _frmMenu.Add (_lblMenuBar); + _lblMenuBar.WantMousePositionReports = true; + _lblMenuBar.CanFocus = true; - var _lblMenuBar = new Label () { - ColorScheme = Colors.Dialog, - TextAlignment = TextAlignment.Centered, - X = Pos.Right (_btnPrevious) + 1, - Y = Pos.Top (_btnPrevious), - Width = Dim.Fill () - Dim.Width (_btnAdd) - 1, - Height = 1 - }; - _frmMenu.Add (_lblMenuBar); - _lblMenuBar.WantMousePositionReports = true; - _lblMenuBar.CanFocus = true; + var _lblParent = new Label () { + TextAlignment = TextAlignment.Centered, + X = Pos.Right (_btnPrevious) + 1, + Y = Pos.Top (_btnPrevious) + 1, + Width = Dim.Fill () - Dim.Width (_btnAdd) - 1 + }; + _frmMenu.Add (_lblParent); - var _lblParent = new Label () { - TextAlignment = TextAlignment.Centered, - X = Pos.Right (_btnPrevious) + 1, - Y = Pos.Top (_btnPrevious) + 1, - Width = Dim.Fill () - Dim.Width (_btnAdd) - 1 - }; - _frmMenu.Add (_lblParent); + var _btnPreviowsParent = new Button ("..") { + X = Pos.Left (_btnAddMenuBar), + Y = Pos.Top (_btnPrevious) + 1 + }; + _frmMenu.Add (_btnPreviowsParent); - var _btnPreviowsParent = new Button ("..") { - X = Pos.Left (_btnAddMenuBar), - Y = Pos.Top (_btnPrevious) + 1 - }; - _frmMenu.Add (_btnPreviowsParent); + _lstMenus = new ListView (new List ()) { + ColorScheme = Colors.Dialog, + X = Pos.Right (_btnPrevious) + 1, + Y = Pos.Top (_btnPrevious) + 2, + Width = _lblMenuBar.Width, + Height = Dim.Fill (), + }; + _frmMenu.Add (_lstMenus); - _lstMenus = new ListView (new List ()) { - ColorScheme = Colors.Dialog, - X = Pos.Right (_btnPrevious) + 1, - Y = Pos.Top (_btnPrevious) + 2, - Width = _lblMenuBar.Width, - Height = Dim.Fill (), - }; - _frmMenu.Add (_lstMenus); + _lblMenuBar.TabIndex = _btnPrevious.TabIndex + 1; + _lstMenus.TabIndex = _lblMenuBar.TabIndex + 1; + _btnNext.TabIndex = _lstMenus.TabIndex + 1; + _btnAdd.TabIndex = _btnNext.TabIndex + 1; - _lblMenuBar.TabIndex = _btnPrevious.TabIndex + 1; - _lstMenus.TabIndex = _lblMenuBar.TabIndex + 1; - _btnNext.TabIndex = _lstMenus.TabIndex + 1; - _btnAdd.TabIndex = _btnNext.TabIndex + 1; + var _btnRemove = new Button ("Remove") { + X = Pos.Left (_btnAdd), + Y = Pos.Top (_btnAdd) + 1 + }; + _frmMenu.Add (_btnRemove); - var _btnRemove = new Button ("Remove") { - X = Pos.Left (_btnAdd), - Y = Pos.Top (_btnAdd) + 1 - }; - _frmMenu.Add (_btnRemove); + var _btnUp = new Button ("^") { + X = Pos.Right (_lstMenus) + 2, + Y = Pos.Top (_btnRemove) + 2 + }; + _frmMenu.Add (_btnUp); - var _btnUp = new Button ("^") { - X = Pos.Right (_lstMenus) + 2, - Y = Pos.Top (_btnRemove) + 2 - }; - _frmMenu.Add (_btnUp); + var _btnDown = new Button ("v") { + X = Pos.Right (_lstMenus) + 2, + Y = Pos.Top (_btnUp) + 1 + }; + _frmMenu.Add (_btnDown); - var _btnDown = new Button ("v") { - X = Pos.Right (_lstMenus) + 2, - Y = Pos.Top (_btnUp) + 1 - }; - _frmMenu.Add (_btnDown); - - Add (_frmMenu); + Add (_frmMenu); - var _frmMenuDetails = new DynamicMenuBarDetails ("Menu Details:") { - X = Pos.Right (_frmMenu), - Y = Pos.Top (_frmMenu), - Width = Dim.Fill (), - Height = Dim.Fill (2) - }; - Add (_frmMenuDetails); + var _frmMenuDetails = new DynamicMenuBarDetails ("Menu Details:") { + X = Pos.Right (_frmMenu), + Y = Pos.Top (_frmMenu), + Width = Dim.Fill (), + Height = Dim.Fill (2) + }; + Add (_frmMenuDetails); - _btnMenuBarUp.Clicked += () => { - var i = _currentSelectedMenuBar; - var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null; - if (menuItem != null) { - var menus = _menuBar.Menus; - if (i > 0) { - menus [i] = menus [i - 1]; - menus [i - 1] = menuItem; - _currentSelectedMenuBar = i - 1; - _menuBar.SetNeedsDisplay (); + _btnMenuBarUp.Clicked += () => { + var i = _currentSelectedMenuBar; + var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null; + if (menuItem != null) { + var menus = _menuBar.Menus; + if (i > 0) { + menus [i] = menus [i - 1]; + menus [i - 1] = menuItem; + _currentSelectedMenuBar = i - 1; + _menuBar.SetNeedsDisplay (); + } } - } - }; + }; - _btnMenuBarDown.Clicked += () => { - var i = _currentSelectedMenuBar; - var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null; - if (menuItem != null) { - var menus = _menuBar.Menus; - if (i < menus.Length - 1) { - menus [i] = menus [i + 1]; - menus [i + 1] = menuItem; - _currentSelectedMenuBar = i + 1; - _menuBar.SetNeedsDisplay (); + _btnMenuBarDown.Clicked += () => { + var i = _currentSelectedMenuBar; + var menuItem = _menuBar != null && _menuBar.Menus.Length > 0 ? _menuBar.Menus [i] : null; + if (menuItem != null) { + var menus = _menuBar.Menus; + if (i < menus.Length - 1) { + menus [i] = menus [i + 1]; + menus [i + 1] = menuItem; + _currentSelectedMenuBar = i + 1; + _menuBar.SetNeedsDisplay (); + } } - } - }; + }; - _btnUp.Clicked += () => { - var i = _lstMenus.SelectedItem; - var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null; - if (menuItem != null) { - var childrens = ((MenuBarItem)_currentMenuBarItem).Children; - if (i > 0) { - childrens [i] = childrens [i - 1]; - childrens [i - 1] = menuItem; - DataContext.Menus [i] = DataContext.Menus [i - 1]; - DataContext.Menus [i - 1] = new DynamicMenuItemList (menuItem.Title, menuItem); - _lstMenus.SelectedItem = i - 1; + _btnUp.Clicked += () => { + var i = _lstMenus.SelectedItem; + var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null; + if (menuItem != null) { + var childrens = ((MenuBarItem)_currentMenuBarItem).Children; + if (i > 0) { + childrens [i] = childrens [i - 1]; + childrens [i - 1] = menuItem; + DataContext.Menus [i] = DataContext.Menus [i - 1]; + DataContext.Menus [i - 1] = new DynamicMenuItemList (menuItem.Title, menuItem); + _lstMenus.SelectedItem = i - 1; + } } - } - }; + }; - _btnDown.Clicked += () => { - var i = _lstMenus.SelectedItem; - var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null; - if (menuItem != null) { - var childrens = ((MenuBarItem)_currentMenuBarItem).Children; - if (i < childrens.Length - 1) { - childrens [i] = childrens [i + 1]; - childrens [i + 1] = menuItem; - DataContext.Menus [i] = DataContext.Menus [i + 1]; - DataContext.Menus [i + 1] = new DynamicMenuItemList (menuItem.Title, menuItem); - _lstMenus.SelectedItem = i + 1; + _btnDown.Clicked += () => { + var i = _lstMenus.SelectedItem; + var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null; + if (menuItem != null) { + var childrens = ((MenuBarItem)_currentMenuBarItem).Children; + if (i < childrens.Length - 1) { + childrens [i] = childrens [i + 1]; + childrens [i + 1] = menuItem; + DataContext.Menus [i] = DataContext.Menus [i + 1]; + DataContext.Menus [i + 1] = new DynamicMenuItemList (menuItem.Title, menuItem); + _lstMenus.SelectedItem = i + 1; + } } - } - }; + }; - _btnPreviowsParent.Clicked += () => { - if (_currentMenuBarItem != null && _currentMenuBarItem.Parent != null) { - var mi = _currentMenuBarItem; - _currentMenuBarItem = _currentMenuBarItem.Parent as MenuBarItem; - SetListViewSource (_currentMenuBarItem, true); - var i = ((MenuBarItem)_currentMenuBarItem).GetChildrenIndex (mi); - if (i > -1) { - _lstMenus.SelectedItem = i; - } - if (_currentMenuBarItem.Parent != null) { - DataContext.Parent = _currentMenuBarItem.Title; + _btnPreviowsParent.Clicked += () => { + if (_currentMenuBarItem != null && _currentMenuBarItem.Parent != null) { + var mi = _currentMenuBarItem; + _currentMenuBarItem = _currentMenuBarItem.Parent as MenuBarItem; + SetListViewSource (_currentMenuBarItem, true); + var i = ((MenuBarItem)_currentMenuBarItem).GetChildrenIndex (mi); + if (i > -1) { + _lstMenus.SelectedItem = i; + } + if (_currentMenuBarItem.Parent != null) { + DataContext.Parent = _currentMenuBarItem.Title; + } else { + DataContext.Parent = ustring.Empty; + } } else { DataContext.Parent = ustring.Empty; } - } else { - DataContext.Parent = ustring.Empty; - } - }; + }; - var _btnOk = new Button ("Ok") { - X = Pos.Right (_frmMenu) + 20, - Y = Pos.Bottom (_frmMenuDetails), - }; - Add (_btnOk); + var _btnOk = new Button ("Ok") { + X = Pos.Right (_frmMenu) + 20, + Y = Pos.Bottom (_frmMenuDetails), + }; + Add (_btnOk); - var _btnCancel = new Button ("Cancel") { - X = Pos.Right (_btnOk) + 3, - Y = Pos.Top (_btnOk), - }; - _btnCancel.Clicked += () => { - SetFrameDetails (_currentEditMenuBarItem); - }; - Add (_btnCancel); + var _btnCancel = new Button ("Cancel") { + X = Pos.Right (_btnOk) + 3, + Y = Pos.Top (_btnOk), + }; + _btnCancel.Clicked += () => { + SetFrameDetails (_currentEditMenuBarItem); + }; + Add (_btnCancel); - _lstMenus.SelectedItemChanged += (e) => { - SetFrameDetails (); - }; - - _btnOk.Clicked += () => { - if (ustring.IsNullOrEmpty (_frmMenuDetails._txtTitle.Text) && _currentEditMenuBarItem != null) { - MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); - } else if (_currentEditMenuBarItem != null) { - var menuItem = new DynamicMenuItem (_frmMenuDetails._txtTitle.Text, _frmMenuDetails._txtHelp.Text, - _frmMenuDetails._txtAction.Text, - _frmMenuDetails._ckbIsTopLevel != null ? _frmMenuDetails._ckbIsTopLevel.Checked : false, - _frmMenuDetails._ckbSubMenu != null ? _frmMenuDetails._ckbSubMenu.Checked : false, - _frmMenuDetails._rbChkStyle.SelectedItem == 0 ? MenuItemCheckStyle.NoCheck : - _frmMenuDetails._rbChkStyle.SelectedItem == 1 ? MenuItemCheckStyle.Checked : - MenuItemCheckStyle.Radio, - _frmMenuDetails._txtShortcut.Text); - UpdateMenuItem (_currentEditMenuBarItem, menuItem, _lstMenus.SelectedItem); - } - }; - - _btnAdd.Clicked += () => { - if (MenuBar == null) { - MessageBox.ErrorQuery ("Menu Bar Error", "Must add a MenuBar first!", "Ok"); - _btnAddMenuBar.SetFocus (); - return; - } - - var frameDetails = new DynamicMenuBarDetails (null, _currentMenuBarItem != null); - var item = frameDetails.EnterMenuItem (); - if (item == null) { - return; - } - - if (!(_currentMenuBarItem is MenuBarItem)) { - var parent = _currentMenuBarItem.Parent as MenuBarItem; - var idx = parent.GetChildrenIndex (_currentMenuBarItem); - _currentMenuBarItem = new MenuBarItem (_currentMenuBarItem.Title, new MenuItem [] { }, _currentMenuBarItem.Parent); - _currentMenuBarItem.CheckType = item.checkStyle; - parent.Children [idx] = _currentMenuBarItem; - } else { - MenuItem newMenu = CreateNewMenu (item, _currentMenuBarItem); - var menuBarItem = _currentMenuBarItem as MenuBarItem; - if (menuBarItem == null) { - menuBarItem = new MenuBarItem (_currentMenuBarItem.Title, new MenuItem [] { newMenu }, _currentMenuBarItem.Parent); - } else if (menuBarItem.Children == null) { - menuBarItem.Children = new MenuItem [] { newMenu }; - } else { - var childrens = menuBarItem.Children; - Array.Resize (ref childrens, childrens.Length + 1); - childrens [childrens.Length - 1] = newMenu; - menuBarItem.Children = childrens; - } - DataContext.Menus.Add (new DynamicMenuItemList (newMenu.Title, newMenu)); - _lstMenus.MoveDown (); - } - }; - - _btnRemove.Clicked += () => { - var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; - if (menuItem != null) { - var childrens = ((MenuBarItem)_currentMenuBarItem).Children; - childrens [_lstMenus.SelectedItem] = null; - int i = 0; - foreach (var c in childrens) { - if (c != null) { - childrens [i] = c; - i++; - } - } - Array.Resize (ref childrens, childrens.Length - 1); - if (childrens.Length == 0) { - if (_currentMenuBarItem.Parent == null) { - ((MenuBarItem)_currentMenuBarItem).Children = null; - //_currentMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, new DynamicMenuItem (_currentMenuBarItem.Title)); - } else { - _currentMenuBarItem = new MenuItem (_currentMenuBarItem.Title, _currentMenuBarItem.Help, _frmMenuDetails.CreateAction (_currentEditMenuBarItem, new DynamicMenuItem (_currentEditMenuBarItem.Title)), null, _currentMenuBarItem.Parent); - } - } else { - ((MenuBarItem)_currentMenuBarItem).Children = childrens; - } - DataContext.Menus.RemoveAt (_lstMenus.SelectedItem); - if (_lstMenus.Source.Count > 0 && _lstMenus.SelectedItem > _lstMenus.Source.Count - 1) { - _lstMenus.SelectedItem = _lstMenus.Source.Count - 1; - } - _lstMenus.SetNeedsDisplay (); + _lstMenus.SelectedItemChanged += (e) => { SetFrameDetails (); - } - }; + }; - _lstMenus.OpenSelectedItem += (e) => { - _currentMenuBarItem = DataContext.Menus [e.Item].MenuItem; - if (!(_currentMenuBarItem is MenuBarItem)) { - MessageBox.ErrorQuery ("Menu Open Error", "Must allows sub menus first!", "Ok"); - return; - } - DataContext.Parent = _currentMenuBarItem.Title; - DataContext.Menus = new List (); - SetListViewSource (_currentMenuBarItem, true); - var menuBarItem = DataContext.Menus.Count > 0 ? DataContext.Menus [0].MenuItem : null; - SetFrameDetails (menuBarItem); - }; - - _lstMenus.Enter += (_) => { - var menuBarItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; - SetFrameDetails (menuBarItem); - }; - - _btnNext.Clicked += () => { - if (_menuBar != null && _currentSelectedMenuBar + 1 < _menuBar.Menus.Length) { - _currentSelectedMenuBar++; - } - SelectCurrentMenuBarItem (); - }; - - _btnPrevious.Clicked += () => { - if (_currentSelectedMenuBar - 1 > -1) { - _currentSelectedMenuBar--; - } - SelectCurrentMenuBarItem (); - }; - - _lblMenuBar.Enter += (e) => { - if (_menuBar?.Menus != null) { - _currentMenuBarItem = _menuBar.Menus [_currentSelectedMenuBar]; - SetFrameDetails (_menuBar.Menus [_currentSelectedMenuBar]); - } - }; - - _btnAddMenuBar.Clicked += () => { - var frameDetails = new DynamicMenuBarDetails (null, false); - var item = frameDetails.EnterMenuItem (); - if (item == null) { - return; - } - - if (MenuBar == null) { - _menuBar = new MenuBar (); - Add (_menuBar); - } - var newMenu = CreateNewMenu (item) as MenuBarItem; - - var menus = _menuBar.Menus; - Array.Resize (ref menus, menus.Length + 1); - menus [^1] = newMenu; - _menuBar.Menus = menus; - _currentMenuBarItem = newMenu; - _currentMenuBarItem.CheckType = item.checkStyle; - _currentSelectedMenuBar = menus.Length - 1; - _menuBar.Menus [_currentSelectedMenuBar] = newMenu; - _lblMenuBar.Text = newMenu.Title; - SetListViewSource (_currentMenuBarItem, true); - SetFrameDetails (_menuBar.Menus [_currentSelectedMenuBar]); - _menuBar.SetNeedsDisplay (); - }; - - _btnRemoveMenuBar.Clicked += () => { - if (_menuBar == null || _menuBar.Menus.Length == 0) { - return; - } - - if (_menuBar != null && _menuBar.Menus.Length > 0) { - _menuBar.Menus [_currentSelectedMenuBar] = null; - int i = 0; - foreach (var m in _menuBar.Menus) { - if (m != null) { - _menuBar.Menus [i] = m; - i++; - } + _btnOk.Clicked += () => { + if (ustring.IsNullOrEmpty (_frmMenuDetails._txtTitle.Text) && _currentEditMenuBarItem != null) { + MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); + } else if (_currentEditMenuBarItem != null) { + var menuItem = new DynamicMenuItem (_frmMenuDetails._txtTitle.Text, _frmMenuDetails._txtHelp.Text, + _frmMenuDetails._txtAction.Text, + _frmMenuDetails._ckbIsTopLevel != null ? _frmMenuDetails._ckbIsTopLevel.Checked : false, + _frmMenuDetails._ckbSubMenu != null ? _frmMenuDetails._ckbSubMenu.Checked : false, + _frmMenuDetails._rbChkStyle.SelectedItem == 0 ? MenuItemCheckStyle.NoCheck : + _frmMenuDetails._rbChkStyle.SelectedItem == 1 ? MenuItemCheckStyle.Checked : + MenuItemCheckStyle.Radio, + _frmMenuDetails._txtShortcut.Text); + UpdateMenuItem (_currentEditMenuBarItem, menuItem, _lstMenus.SelectedItem); } - var menus = _menuBar.Menus; - Array.Resize (ref menus, menus.Length - 1); - _menuBar.Menus = menus; - if (_currentSelectedMenuBar - 1 >= 0 && _menuBar.Menus.Length > 0) { + }; + + _btnAdd.Clicked += () => { + if (MenuBar == null) { + MessageBox.ErrorQuery ("Menu Bar Error", "Must add a MenuBar first!", "Ok"); + _btnAddMenuBar.SetFocus (); + return; + } + + var frameDetails = new DynamicMenuBarDetails (null, _currentMenuBarItem != null); + var item = frameDetails.EnterMenuItem (); + if (item == null) { + return; + } + + if (!(_currentMenuBarItem is MenuBarItem)) { + var parent = _currentMenuBarItem.Parent as MenuBarItem; + var idx = parent.GetChildrenIndex (_currentMenuBarItem); + _currentMenuBarItem = new MenuBarItem (_currentMenuBarItem.Title, new MenuItem [] { }, _currentMenuBarItem.Parent); + _currentMenuBarItem.CheckType = item.checkStyle; + parent.Children [idx] = _currentMenuBarItem; + } else { + MenuItem newMenu = CreateNewMenu (item, _currentMenuBarItem); + var menuBarItem = _currentMenuBarItem as MenuBarItem; + if (menuBarItem == null) { + menuBarItem = new MenuBarItem (_currentMenuBarItem.Title, new MenuItem [] { newMenu }, _currentMenuBarItem.Parent); + } else if (menuBarItem.Children == null) { + menuBarItem.Children = new MenuItem [] { newMenu }; + } else { + var childrens = menuBarItem.Children; + Array.Resize (ref childrens, childrens.Length + 1); + childrens [childrens.Length - 1] = newMenu; + menuBarItem.Children = childrens; + } + DataContext.Menus.Add (new DynamicMenuItemList (newMenu.Title, newMenu)); + _lstMenus.MoveDown (); + } + }; + + _btnRemove.Clicked += () => { + var menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; + if (menuItem != null) { + var childrens = ((MenuBarItem)_currentMenuBarItem).Children; + childrens [_lstMenus.SelectedItem] = null; + int i = 0; + foreach (var c in childrens) { + if (c != null) { + childrens [i] = c; + i++; + } + } + Array.Resize (ref childrens, childrens.Length - 1); + if (childrens.Length == 0) { + if (_currentMenuBarItem.Parent == null) { + ((MenuBarItem)_currentMenuBarItem).Children = null; + //_currentMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, new DynamicMenuItem (_currentMenuBarItem.Title)); + } else { + _currentMenuBarItem = new MenuItem (_currentMenuBarItem.Title, _currentMenuBarItem.Help, _frmMenuDetails.CreateAction (_currentEditMenuBarItem, new DynamicMenuItem (_currentEditMenuBarItem.Title)), null, _currentMenuBarItem.Parent); + } + } else { + ((MenuBarItem)_currentMenuBarItem).Children = childrens; + } + DataContext.Menus.RemoveAt (_lstMenus.SelectedItem); + if (_lstMenus.Source.Count > 0 && _lstMenus.SelectedItem > _lstMenus.Source.Count - 1) { + _lstMenus.SelectedItem = _lstMenus.Source.Count - 1; + } + _lstMenus.SetNeedsDisplay (); + SetFrameDetails (); + } + }; + + _lstMenus.OpenSelectedItem += (e) => { + _currentMenuBarItem = DataContext.Menus [e.Item].MenuItem; + if (!(_currentMenuBarItem is MenuBarItem)) { + MessageBox.ErrorQuery ("Menu Open Error", "Must allows sub menus first!", "Ok"); + return; + } + DataContext.Parent = _currentMenuBarItem.Title; + DataContext.Menus = new List (); + SetListViewSource (_currentMenuBarItem, true); + var menuBarItem = DataContext.Menus.Count > 0 ? DataContext.Menus [0].MenuItem : null; + SetFrameDetails (menuBarItem); + }; + + _lstMenus.Enter += (_) => { + var menuBarItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; + SetFrameDetails (menuBarItem); + }; + + _btnNext.Clicked += () => { + if (_menuBar != null && _currentSelectedMenuBar + 1 < _menuBar.Menus.Length) { + _currentSelectedMenuBar++; + } + SelectCurrentMenuBarItem (); + }; + + _btnPrevious.Clicked += () => { + if (_currentSelectedMenuBar - 1 > -1) { _currentSelectedMenuBar--; } - _currentMenuBarItem = _menuBar.Menus?.Length > 0 ? _menuBar.Menus [_currentSelectedMenuBar] : null; - } - if (MenuBar != null && _currentMenuBarItem == null && _menuBar.Menus.Length == 0) { - Remove (_menuBar); - _menuBar = null; - DataContext.Menus = new List (); - _currentMenuBarItem = null; - _currentSelectedMenuBar = -1; - _lblMenuBar.Text = ustring.Empty; - } else { - _lblMenuBar.Text = _menuBar.Menus [_currentSelectedMenuBar].Title; - } - SetListViewSource (_currentMenuBarItem, true); - SetFrameDetails (null); - }; + SelectCurrentMenuBarItem (); + }; - - SetFrameDetails (); - - - var ustringConverter = new UStringValueConverter (); - var listWrapperConverter = new ListWrapperConverter (); - - var lblMenuBar = new Binding (this, "MenuBar", _lblMenuBar, "Text", ustringConverter); - var lblParent = new Binding (this, "Parent", _lblParent, "Text", ustringConverter); - var lstMenus = new Binding (this, "Menus", _lstMenus, "Source", listWrapperConverter); - - - void SetFrameDetails (MenuItem menuBarItem = null) - { - MenuItem menuItem; - - if (menuBarItem == null) { - menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; - } else { - menuItem = menuBarItem; - } - - _currentEditMenuBarItem = menuItem; - _frmMenuDetails.EditMenuBarItem (menuItem); - var f = _btnOk.Enabled == _frmMenuDetails.Enabled; - if (!f) { - _btnOk.Enabled = _frmMenuDetails.Enabled; - _btnCancel.Enabled = _frmMenuDetails.Enabled; - } - } - - void SelectCurrentMenuBarItem () - { - MenuBarItem menuBarItem = null; - if (_menuBar?.Menus != null) { - menuBarItem = _menuBar.Menus [_currentSelectedMenuBar]; - _lblMenuBar.Text = menuBarItem.Title; - } - SetFrameDetails (menuBarItem); - _currentMenuBarItem = menuBarItem; - DataContext.Menus = new List (); - SetListViewSource (_currentMenuBarItem, true); - _lblParent.Text = ustring.Empty; - } - - void SetListViewSource (MenuItem _currentMenuBarItem, bool fill = false) - { - DataContext.Menus = new List (); - var menuBarItem = _currentMenuBarItem as MenuBarItem; - if (menuBarItem != null && menuBarItem?.Children == null) { - return; - } - if (!fill) { - return; - } - if (menuBarItem != null) { - foreach (var child in menuBarItem?.Children) { - var m = new DynamicMenuItemList (child.Title, child); - DataContext.Menus.Add (m); + _lblMenuBar.Enter += (e) => { + if (_menuBar?.Menus != null) { + _currentMenuBarItem = _menuBar.Menus [_currentSelectedMenuBar]; + SetFrameDetails (_menuBar.Menus [_currentSelectedMenuBar]); } - } - } + }; - MenuItem CreateNewMenu (DynamicMenuItem item, MenuItem parent = null) - { - MenuItem newMenu; - if (item.hasSubMenu) { - newMenu = new MenuBarItem (item.title, new MenuItem [] { }, parent); - } else if (parent != null) { - newMenu = new MenuItem (item.title, item.help, null, null, parent); - newMenu.CheckType = item.checkStyle; - newMenu.Action = _frmMenuDetails.CreateAction (newMenu, item); - newMenu.Shortcut = ShortcutHelper.GetShortcutFromTag (item.shortcut); - } else if (item.isTopLevel) { - newMenu = new MenuBarItem (item.title, item.help, null); - newMenu.Action = _frmMenuDetails.CreateAction (newMenu, item); - } else { - newMenu = new MenuBarItem (item.title, item.help, null); - ((MenuBarItem)newMenu).Children [0].Action = _frmMenuDetails.CreateAction (newMenu, item); - ((MenuBarItem)newMenu).Children [0].Shortcut = ShortcutHelper.GetShortcutFromTag (item.shortcut); - } - - return newMenu; - } - - void UpdateMenuItem (MenuItem _currentEditMenuBarItem, DynamicMenuItem menuItem, int index) - { - _currentEditMenuBarItem.Title = menuItem.title; - _currentEditMenuBarItem.Help = menuItem.help; - _currentEditMenuBarItem.CheckType = menuItem.checkStyle; - var parent = _currentEditMenuBarItem.Parent as MenuBarItem; - if (parent != null && parent.Children.Length == 1 && _currentEditMenuBarItem.CheckType == MenuItemCheckStyle.Radio) { - _currentEditMenuBarItem.Checked = true; - } - if (menuItem.isTopLevel && _currentEditMenuBarItem is MenuBarItem) { - ((MenuBarItem)_currentEditMenuBarItem).Children = null; - _currentEditMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem); - SetListViewSource (_currentEditMenuBarItem, true); - } else if (menuItem.hasSubMenu) { - _currentEditMenuBarItem.Action = null; - if (_currentEditMenuBarItem is MenuBarItem && ((MenuBarItem)_currentEditMenuBarItem).Children == null) { - ((MenuBarItem)_currentEditMenuBarItem).Children = new MenuItem [] { }; - } else if (_currentEditMenuBarItem.Parent != null) { - _frmMenuDetails.UpdateParent (ref _currentEditMenuBarItem); - } else { - _currentEditMenuBarItem = new MenuBarItem (_currentEditMenuBarItem.Title, new MenuItem [] { }, _currentEditMenuBarItem.Parent); + _btnAddMenuBar.Clicked += () => { + var frameDetails = new DynamicMenuBarDetails (null, false); + var item = frameDetails.EnterMenuItem (); + if (item == null) { + return; } - SetListViewSource (_currentEditMenuBarItem, true); - } else if (_currentEditMenuBarItem is MenuBarItem && _currentEditMenuBarItem.Parent != null) { - _frmMenuDetails.UpdateParent (ref _currentEditMenuBarItem); - _currentEditMenuBarItem = new MenuItem (menuItem.title, menuItem.help, _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem), null, _currentEditMenuBarItem.Parent); - } else { - if (_currentEditMenuBarItem is MenuBarItem) { - ((MenuBarItem)_currentEditMenuBarItem).Children = null; + + if (MenuBar == null) { + _menuBar = new MenuBar (); + Add (_menuBar); + } + var newMenu = CreateNewMenu (item) as MenuBarItem; + + var menus = _menuBar.Menus; + Array.Resize (ref menus, menus.Length + 1); + menus [^1] = newMenu; + _menuBar.Menus = menus; + _currentMenuBarItem = newMenu; + _currentMenuBarItem.CheckType = item.checkStyle; + _currentSelectedMenuBar = menus.Length - 1; + _menuBar.Menus [_currentSelectedMenuBar] = newMenu; + _lblMenuBar.Text = newMenu.Title; + SetListViewSource (_currentMenuBarItem, true); + SetFrameDetails (_menuBar.Menus [_currentSelectedMenuBar]); + _menuBar.SetNeedsDisplay (); + }; + + _btnRemoveMenuBar.Clicked += () => { + if (_menuBar == null || _menuBar.Menus.Length == 0) { + return; + } + + if (_menuBar != null && _menuBar.Menus.Length > 0) { + _menuBar.Menus [_currentSelectedMenuBar] = null; + int i = 0; + foreach (var m in _menuBar.Menus) { + if (m != null) { + _menuBar.Menus [i] = m; + i++; + } + } + var menus = _menuBar.Menus; + Array.Resize (ref menus, menus.Length - 1); + _menuBar.Menus = menus; + if (_currentSelectedMenuBar - 1 >= 0 && _menuBar.Menus.Length > 0) { + _currentSelectedMenuBar--; + } + _currentMenuBarItem = _menuBar.Menus?.Length > 0 ? _menuBar.Menus [_currentSelectedMenuBar] : null; + } + if (MenuBar != null && _currentMenuBarItem == null && _menuBar.Menus.Length == 0) { + Remove (_menuBar); + _menuBar = null; DataContext.Menus = new List (); + _currentMenuBarItem = null; + _currentSelectedMenuBar = -1; + _lblMenuBar.Text = ustring.Empty; + } else { + _lblMenuBar.Text = _menuBar.Menus [_currentSelectedMenuBar].Title; + } + SetListViewSource (_currentMenuBarItem, true); + SetFrameDetails (null); + }; + + + SetFrameDetails (); + + + var ustringConverter = new UStringValueConverter (); + var listWrapperConverter = new ListWrapperConverter (); + + var lblMenuBar = new Binding (this, "MenuBar", _lblMenuBar, "Text", ustringConverter); + var lblParent = new Binding (this, "Parent", _lblParent, "Text", ustringConverter); + var lstMenus = new Binding (this, "Menus", _lstMenus, "Source", listWrapperConverter); + + + void SetFrameDetails (MenuItem menuBarItem = null) + { + MenuItem menuItem; + + if (menuBarItem == null) { + menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem : null; + } else { + menuItem = menuBarItem; + } + + _currentEditMenuBarItem = menuItem; + _frmMenuDetails.EditMenuBarItem (menuItem); + var f = _btnOk.Enabled == _frmMenuDetails.Enabled; + if (!f) { + _btnOk.Enabled = _frmMenuDetails.Enabled; + _btnCancel.Enabled = _frmMenuDetails.Enabled; } - _currentEditMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem); - _currentEditMenuBarItem.Shortcut = ShortcutHelper.GetShortcutFromTag (menuItem.shortcut); } - if (_currentEditMenuBarItem.Parent == null) { - DataContext.MenuBar = _currentEditMenuBarItem.Title; - } else { - if (DataContext.Menus.Count == 0) { - DataContext.Menus.Add (new DynamicMenuItemList (_currentEditMenuBarItem.Title, _currentEditMenuBarItem)); + void SelectCurrentMenuBarItem () + { + MenuBarItem menuBarItem = null; + if (_menuBar?.Menus != null) { + menuBarItem = _menuBar.Menus [_currentSelectedMenuBar]; + _lblMenuBar.Text = menuBarItem.Title; } - DataContext.Menus [index] = new DynamicMenuItemList (_currentEditMenuBarItem.Title, _currentEditMenuBarItem); + SetFrameDetails (menuBarItem); + _currentMenuBarItem = menuBarItem; + DataContext.Menus = new List (); + SetListViewSource (_currentMenuBarItem, true); + _lblParent.Text = ustring.Empty; } - _currentEditMenuBarItem.CheckType = menuItem.checkStyle; - SetFrameDetails (_currentEditMenuBarItem); + + void SetListViewSource (MenuItem _currentMenuBarItem, bool fill = false) + { + DataContext.Menus = new List (); + var menuBarItem = _currentMenuBarItem as MenuBarItem; + if (menuBarItem != null && menuBarItem?.Children == null) { + return; + } + if (!fill) { + return; + } + if (menuBarItem != null) { + foreach (var child in menuBarItem?.Children) { + var m = new DynamicMenuItemList (child.Title, child); + DataContext.Menus.Add (m); + } + } + } + + MenuItem CreateNewMenu (DynamicMenuItem item, MenuItem parent = null) + { + MenuItem newMenu; + if (item.hasSubMenu) { + newMenu = new MenuBarItem (item.title, new MenuItem [] { }, parent); + } else if (parent != null) { + newMenu = new MenuItem (item.title, item.help, null, null, parent); + newMenu.CheckType = item.checkStyle; + newMenu.Action = _frmMenuDetails.CreateAction (newMenu, item); + newMenu.Shortcut = ShortcutHelper.GetShortcutFromTag (item.shortcut); + } else if (item.isTopLevel) { + newMenu = new MenuBarItem (item.title, item.help, null); + newMenu.Action = _frmMenuDetails.CreateAction (newMenu, item); + } else { + newMenu = new MenuBarItem (item.title, item.help, null); + ((MenuBarItem)newMenu).Children [0].Action = _frmMenuDetails.CreateAction (newMenu, item); + ((MenuBarItem)newMenu).Children [0].Shortcut = ShortcutHelper.GetShortcutFromTag (item.shortcut); + } + + return newMenu; + } + + void UpdateMenuItem (MenuItem _currentEditMenuBarItem, DynamicMenuItem menuItem, int index) + { + _currentEditMenuBarItem.Title = menuItem.title; + _currentEditMenuBarItem.Help = menuItem.help; + _currentEditMenuBarItem.CheckType = menuItem.checkStyle; + var parent = _currentEditMenuBarItem.Parent as MenuBarItem; + if (parent != null && parent.Children.Length == 1 && _currentEditMenuBarItem.CheckType == MenuItemCheckStyle.Radio) { + _currentEditMenuBarItem.Checked = true; + } + if (menuItem.isTopLevel && _currentEditMenuBarItem is MenuBarItem) { + ((MenuBarItem)_currentEditMenuBarItem).Children = null; + _currentEditMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem); + SetListViewSource (_currentEditMenuBarItem, true); + } else if (menuItem.hasSubMenu) { + _currentEditMenuBarItem.Action = null; + if (_currentEditMenuBarItem is MenuBarItem && ((MenuBarItem)_currentEditMenuBarItem).Children == null) { + ((MenuBarItem)_currentEditMenuBarItem).Children = new MenuItem [] { }; + } else if (_currentEditMenuBarItem.Parent != null) { + _frmMenuDetails.UpdateParent (ref _currentEditMenuBarItem); + } else { + _currentEditMenuBarItem = new MenuBarItem (_currentEditMenuBarItem.Title, new MenuItem [] { }, _currentEditMenuBarItem.Parent); + } + SetListViewSource (_currentEditMenuBarItem, true); + } else if (_currentEditMenuBarItem is MenuBarItem && _currentEditMenuBarItem.Parent != null) { + _frmMenuDetails.UpdateParent (ref _currentEditMenuBarItem); + _currentEditMenuBarItem = new MenuItem (menuItem.title, menuItem.help, _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem), null, _currentEditMenuBarItem.Parent); + } else { + if (_currentEditMenuBarItem is MenuBarItem) { + ((MenuBarItem)_currentEditMenuBarItem).Children = null; + DataContext.Menus = new List (); + } + _currentEditMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem); + _currentEditMenuBarItem.Shortcut = ShortcutHelper.GetShortcutFromTag (menuItem.shortcut); + } + + if (_currentEditMenuBarItem.Parent == null) { + DataContext.MenuBar = _currentEditMenuBarItem.Title; + } else { + if (DataContext.Menus.Count == 0) { + DataContext.Menus.Add (new DynamicMenuItemList (_currentEditMenuBarItem.Title, _currentEditMenuBarItem)); + } + DataContext.Menus [index] = new DynamicMenuItemList (_currentEditMenuBarItem.Title, _currentEditMenuBarItem); + } + _currentEditMenuBarItem.CheckType = menuItem.checkStyle; + SetFrameDetails (_currentEditMenuBarItem); + } + + + //_frmMenuDetails.Initialized += (s, e) => _frmMenuDetails.Enabled = false; } - - - //_frmMenuDetails.Initialized += (s, e) => _frmMenuDetails.Enabled = false; - } - } - - public class DynamicMenuBarDetails : FrameView { - public MenuItem _menuItem; - public TextField _txtTitle; - public TextField _txtHelp; - public TextView _txtAction; - public CheckBox _ckbIsTopLevel; - public CheckBox _ckbSubMenu; - public RadioGroup _rbChkStyle; - public TextField _txtShortcut; - - bool hasParent; - - public DynamicMenuBarDetails (MenuItem menuItem = null, bool hasParent = false) : this (menuItem == null ? "Adding New Menu." : "Editing Menu.") - { - _menuItem = menuItem; - this.hasParent = hasParent; } - public DynamicMenuBarDetails (ustring title) : base (title) - { - var _lblTitle = new Label ("Title:") { - Y = 1 - }; - Add (_lblTitle); + public class DynamicMenuBarDetails : FrameView { + public MenuItem _menuItem; + public TextField _txtTitle; + public TextField _txtHelp; + public TextView _txtAction; + public CheckBox _ckbIsTopLevel; + public CheckBox _ckbSubMenu; + public RadioGroup _rbChkStyle; + public TextField _txtShortcut; - _txtTitle = new TextField () { - X = Pos.Right (_lblTitle) + 2, - Y = Pos.Top (_lblTitle), - Width = Dim.Fill () - }; - Add (_txtTitle); + bool hasParent; - var _lblHelp = new Label ("Help:") { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_lblTitle) + 1 - }; - Add (_lblHelp); - - _txtHelp = new TextField () { - X = Pos.Left (_txtTitle), - Y = Pos.Top (_lblHelp), - Width = Dim.Fill () - }; - Add (_txtHelp); - - var _lblAction = new Label ("Action:") { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_lblHelp) + 1 - }; - Add (_lblAction); - - _txtAction = new TextView () { - ColorScheme = Colors.Dialog, - X = Pos.Left (_txtTitle), - Y = Pos.Top (_lblAction), - Width = Dim.Fill (), - Height = 5 - }; - Add (_txtAction); - - _ckbIsTopLevel = new CheckBox ("IsTopLevel") { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_lblAction) + 5 - }; - Add (_ckbIsTopLevel); - - _ckbSubMenu = new CheckBox ("Has sub-menus") { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_ckbIsTopLevel), - Checked = _menuItem == null ? !hasParent : HasSubMenus (_menuItem) - }; - Add (_ckbSubMenu); - - var _rChkLabels = new ustring [] { "NoCheck", "Checked", "Radio" }; - _rbChkStyle = new RadioGroup (_rChkLabels) { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_ckbSubMenu) + 1, - }; - Add (_rbChkStyle); - - var _lblShortcut = new Label ("Shortcut:") { - X = Pos.Right (_ckbSubMenu) + 10, - Y = Pos.Top (_ckbSubMenu) - }; - Add (_lblShortcut); - - _txtShortcut = new TextField () { - X = Pos.X (_lblShortcut), - Y = Pos.Bottom (_lblShortcut), - Width = Dim.Fill (), - ReadOnly = true - }; - _txtShortcut.KeyDown += (e) => { - if (!ProcessKey (e.KeyEvent)) { - return; - } - - var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); - if (CheckShortcut (k, true)) { - e.Handled = true; - } - }; - - bool ProcessKey (KeyEvent ev) + public DynamicMenuBarDetails (MenuItem menuItem = null, bool hasParent = false) : this (menuItem == null ? "Adding New Menu." : "Editing Menu.") { - switch (ev.Key) { - case Key.CursorUp: - case Key.CursorDown: - case Key.Tab: - case Key.BackTab: - return false; - } - - return true; + _menuItem = menuItem; + this.hasParent = hasParent; } - bool CheckShortcut (Key k, bool pre) + public DynamicMenuBarDetails (ustring title) : base (title) { - var m = _menuItem != null ? _menuItem : new MenuItem (); - if (pre && !ShortcutHelper.PreShortcutValidation (k)) { - _txtShortcut.Text = ""; - return false; + var _lblTitle = new Label ("Title:") { + Y = 1 + }; + Add (_lblTitle); + + _txtTitle = new TextField () { + X = Pos.Right (_lblTitle) + 2, + Y = Pos.Top (_lblTitle), + Width = Dim.Fill () + }; + Add (_txtTitle); + + var _lblHelp = new Label ("Help:") { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_lblTitle) + 1 + }; + Add (_lblHelp); + + _txtHelp = new TextField () { + X = Pos.Left (_txtTitle), + Y = Pos.Top (_lblHelp), + Width = Dim.Fill () + }; + Add (_txtHelp); + + var _lblAction = new Label ("Action:") { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_lblHelp) + 1 + }; + Add (_lblAction); + + _txtAction = new TextView () { + ColorScheme = Colors.Dialog, + X = Pos.Left (_txtTitle), + Y = Pos.Top (_lblAction), + Width = Dim.Fill (), + Height = 5 + }; + Add (_txtAction); + + _ckbIsTopLevel = new CheckBox ("IsTopLevel") { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_lblAction) + 5 + }; + Add (_ckbIsTopLevel); + + _ckbSubMenu = new CheckBox ("Has sub-menus") { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_ckbIsTopLevel), + Checked = _menuItem == null ? !hasParent : HasSubMenus (_menuItem) + }; + Add (_ckbSubMenu); + + var _rChkLabels = new ustring [] { "NoCheck", "Checked", "Radio" }; + _rbChkStyle = new RadioGroup (_rChkLabels) { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_ckbSubMenu) + 1, + }; + Add (_rbChkStyle); + + var _lblShortcut = new Label ("Shortcut:") { + X = Pos.Right (_ckbSubMenu) + 10, + Y = Pos.Top (_ckbSubMenu) + }; + Add (_lblShortcut); + + _txtShortcut = new TextField () { + X = Pos.X (_lblShortcut), + Y = Pos.Bottom (_lblShortcut), + Width = Dim.Fill (), + ReadOnly = true + }; + _txtShortcut.KeyDown += (e) => { + if (!ProcessKey (e.KeyEvent)) { + return; + } + + var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); + if (CheckShortcut (k, true)) { + e.Handled = true; + } + }; + + bool ProcessKey (KeyEvent ev) + { + switch (ev.Key) { + case Key.CursorUp: + case Key.CursorDown: + case Key.Tab: + case Key.BackTab: + return false; + } + + return true; } - if (!pre) { - if (!ShortcutHelper.PostShortcutValidation (ShortcutHelper.GetShortcutFromTag (_txtShortcut.Text))) { + + bool CheckShortcut (Key k, bool pre) + { + var m = _menuItem != null ? _menuItem : new MenuItem (); + if (pre && !ShortcutHelper.PreShortcutValidation (k)) { _txtShortcut.Text = ""; return false; } + if (!pre) { + if (!ShortcutHelper.PostShortcutValidation (ShortcutHelper.GetShortcutFromTag (_txtShortcut.Text))) { + _txtShortcut.Text = ""; + return false; + } + return true; + } + _txtShortcut.Text = ShortcutHelper.GetShortcutTag (k); + return true; } - _txtShortcut.Text = ShortcutHelper.GetShortcutTag (k); - return true; - } - - _txtShortcut.KeyUp += (e) => { - var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); - if (CheckShortcut (k, false)) { - e.Handled = true; - } - }; - Add (_txtShortcut); - - var _btnShortcut = new Button ("Clear Shortcut") { - X = Pos.X (_lblShortcut), - Y = Pos.Bottom (_txtShortcut) + 1 - }; - _btnShortcut.Clicked += () => { - _txtShortcut.Text = ""; - }; - Add (_btnShortcut); - - _ckbIsTopLevel.Toggled += (e) => { - if ((_menuItem != null && _menuItem.Parent != null && _ckbIsTopLevel.Checked) || - _menuItem == null && hasParent && _ckbIsTopLevel.Checked) { - MessageBox.ErrorQuery ("Invalid IsTopLevel", "Only menu bar can have top level menu item!", "Ok"); - _ckbIsTopLevel.Checked = false; - return; - } - if (_ckbIsTopLevel.Checked) { - _ckbSubMenu.Checked = false; - _ckbSubMenu.SetNeedsDisplay (); - _txtHelp.Enabled = true; - _txtAction.Enabled = true; - _txtShortcut.Enabled = !_ckbIsTopLevel.Checked && !_ckbSubMenu.Checked; - } else { - if (_menuItem == null && !hasParent || _menuItem.Parent == null) { - _ckbSubMenu.Checked = true; - _ckbSubMenu.SetNeedsDisplay (); - _txtShortcut.Enabled = false; - } - _txtHelp.Text = ""; - _txtHelp.Enabled = false; - _txtAction.Text = ""; - _txtAction.Enabled = false; - } - }; - _ckbSubMenu.Toggled += (e) => { - if (_ckbSubMenu.Checked) { - _ckbIsTopLevel.Checked = false; - _ckbIsTopLevel.SetNeedsDisplay (); - _txtHelp.Text = ""; - _txtHelp.Enabled = false; - _txtAction.Text = ""; - _txtAction.Enabled = false; - _txtShortcut.Text = ""; - _txtShortcut.Enabled = false; - } else { - if (!hasParent) { - _ckbIsTopLevel.Checked = true; - _ckbIsTopLevel.SetNeedsDisplay (); - _txtShortcut.Enabled = false; - } - _txtHelp.Enabled = true; - _txtAction.Enabled = true; - _txtShortcut.Enabled = !_ckbIsTopLevel.Checked && !_ckbSubMenu.Checked; - } - }; - - //Add (_frmMenuDetails); - - } - - - public DynamicMenuItem EnterMenuItem () - { - var valid = false; - - if (_menuItem == null) { - var m = new DynamicMenuItem (); - _txtTitle.Text = m.title; - _txtHelp.Text = m.help; - _txtAction.Text = m.action; - _ckbIsTopLevel.Checked = false; - _ckbSubMenu.Checked = !hasParent; - _txtHelp.Enabled = hasParent; - _txtAction.Enabled = hasParent; - _txtShortcut.Enabled = hasParent; - } else { - EditMenuBarItem (_menuItem); - } - - var _btnOk = new Button ("Ok") { - IsDefault = true, - }; - _btnOk.Clicked += () => { - if (ustring.IsNullOrEmpty (_txtTitle.Text)) { - MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); - } else { - valid = true; - Application.RequestStop (); - } - }; - var _btnCancel = new Button ("Cancel"); - _btnCancel.Clicked += () => { - _txtTitle.Text = ustring.Empty; - Application.RequestStop (); - }; - var _dialog = new Dialog ("Please enter the menu details.", _btnOk, _btnCancel); - - Width = Dim.Fill (); - Height = Dim.Fill () - 1; - _dialog.Add (this); - _txtTitle.SetFocus (); - _txtTitle.CursorPosition = _txtTitle.Text.Length; - Application.Run (_dialog); - - if (valid) { - return new DynamicMenuItem (_txtTitle.Text, _txtHelp.Text, _txtAction.Text, - _ckbIsTopLevel != null ? _ckbIsTopLevel.Checked : false, - _ckbSubMenu != null ? _ckbSubMenu.Checked : false, - _rbChkStyle.SelectedItem == 0 ? MenuItemCheckStyle.NoCheck : - _rbChkStyle.SelectedItem == 1 ? MenuItemCheckStyle.Checked : MenuItemCheckStyle.Radio, - _txtShortcut.Text); - } else { - return null; - } - } - - public void EditMenuBarItem (MenuItem menuItem) - { - if (menuItem == null) { - hasParent = false; - Enabled = false; - CleanEditMenuBarItem (); - return; - } else { - hasParent = menuItem.Parent != null; - Enabled = true; - } - _menuItem = menuItem; - _txtTitle.Text = menuItem?.Title ?? ""; - _txtHelp.Text = menuItem?.Help ?? ""; - _txtAction.Text = menuItem != null && menuItem.Action != null ? GetTargetAction (menuItem.Action) : ustring.Empty; - _ckbIsTopLevel.Checked = IsTopLevel (menuItem); - _ckbSubMenu.Checked = HasSubMenus (menuItem); - _txtHelp.Enabled = !_ckbSubMenu.Checked; - _txtAction.Enabled = !_ckbSubMenu.Checked; - _rbChkStyle.SelectedItem = (int)(menuItem?.CheckType ?? MenuItemCheckStyle.NoCheck); - _txtShortcut.Text = menuItem?.ShortcutTag ?? ""; - _txtShortcut.Enabled = !_ckbIsTopLevel.Checked && !_ckbSubMenu.Checked; - } - - void CleanEditMenuBarItem () - { - _txtTitle.Text = ""; - _txtHelp.Text = ""; - _txtAction.Text = ""; - _ckbIsTopLevel.Checked = false; - _ckbSubMenu.Checked = false; - _rbChkStyle.SelectedItem = (int)MenuItemCheckStyle.NoCheck; - _txtShortcut.Text = ""; - } - - ustring GetTargetAction (Action action) - { - var me = action.Target; - - if (me == null) { - throw new ArgumentException (); - } - object v = new object (); - foreach (var field in me.GetType ().GetFields ()) { - if (field.Name == "item") { - v = field.GetValue (me); - } - } - return v == null || !(v is DynamicMenuItem item) ? ustring.Empty : item.action; - } - - bool IsTopLevel (MenuItem menuItem) - { - var topLevel = menuItem as MenuBarItem; - if (topLevel != null && topLevel.Parent == null && (topLevel.Children == null || topLevel.Children.Length == 0) && topLevel.Action != null) { - return true; - } else { - return false; - } - } - - bool HasSubMenus (MenuItem menuItem) - { - var menuBarItem = menuItem as MenuBarItem; - if (menuBarItem != null && menuBarItem.Children != null && (menuBarItem.Children.Length > 0 || menuBarItem.Action == null)) { - return true; - } else { - return false; - } - } - - public Action CreateAction (MenuItem menuItem, DynamicMenuItem item) - { - switch (menuItem.CheckType) { - case MenuItemCheckStyle.NoCheck: - return new Action (() => MessageBox.ErrorQuery (item.title, item.action, "Ok")); - case MenuItemCheckStyle.Checked: - return new Action (() => menuItem.Checked = !menuItem.Checked); - case MenuItemCheckStyle.Radio: - break; - } - return new Action (() => { - menuItem.Checked = true; - var parent = menuItem?.Parent as MenuBarItem; - if (parent != null) { - var childrens = parent.Children; - for (int i = 0; i < childrens.Length; i++) { - var child = childrens [i]; - if (child != menuItem) { - child.Checked = false; - } - } - } - }); - } - - public void UpdateParent (ref MenuItem menuItem) - { - var parent = menuItem.Parent as MenuBarItem; - var idx = parent.GetChildrenIndex (menuItem); - if (!(menuItem is MenuBarItem)) { - menuItem = new MenuBarItem (menuItem.Title, new MenuItem [] { }, menuItem.Parent); - if (idx > -1) { - parent.Children [idx] = menuItem; - } - } else { - menuItem = new MenuItem (menuItem.Title, menuItem.Help, CreateAction (menuItem, new DynamicMenuItem ()), null, menuItem.Parent); - if (idx > -1) { - parent.Children [idx] = menuItem; - } - } - } - } - - public class DynamicMenuItemModel : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; - - private ustring menuBar; - private ustring parent; - private List menus; - - public ustring MenuBar { - get => menuBar; - set { - if (value != menuBar) { - menuBar = value; - PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); - } - } - } - - public ustring Parent { - get => parent; - set { - if (value != parent) { - parent = value; - PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); - } - } - } - - public List Menus { - get => menus; - set { - if (value != menus) { - menus = value; - PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); - } - } - } - - public DynamicMenuItemModel () - { - Menus = new List (); - } - - public string GetPropertyName ([CallerMemberName] string propertyName = null) - { - return propertyName; - } - } - - public interface IValueConverter { - object Convert (object value, object parameter = null); - } - - public class Binding { - public View Target { get; private set; } - public View Source { get; private set; } - - public string SourcePropertyName { get; private set; } - public string TargetPropertyName { get; private set; } - - private object sourceDataContext; - private PropertyInfo sourceBindingProperty; - private IValueConverter valueConverter; - - public Binding (View source, string sourcePropertyName, View target, string targetPropertyName, IValueConverter valueConverter = null) - { - Target = target; - Source = source; - SourcePropertyName = sourcePropertyName; - TargetPropertyName = targetPropertyName; - sourceDataContext = Source.GetType ().GetProperty ("DataContext").GetValue (Source); - sourceBindingProperty = sourceDataContext.GetType ().GetProperty (SourcePropertyName); - this.valueConverter = valueConverter; - UpdateTarget (); - - var notifier = ((INotifyPropertyChanged)sourceDataContext); - if (notifier != null) { - notifier.PropertyChanged += (s, e) => { - if (e.PropertyName == SourcePropertyName) { - UpdateTarget (); + _txtShortcut.KeyUp += (e) => { + var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); + if (CheckShortcut (k, false)) { + e.Handled = true; } }; - } - } + Add (_txtShortcut); - private void UpdateTarget () - { - try { - var sourceValue = sourceBindingProperty.GetValue (sourceDataContext); - if (sourceValue == null) { - return; + var _btnShortcut = new Button ("Clear Shortcut") { + X = Pos.X (_lblShortcut), + Y = Pos.Bottom (_txtShortcut) + 1 + }; + _btnShortcut.Clicked += () => { + _txtShortcut.Text = ""; + }; + Add (_btnShortcut); + + _ckbIsTopLevel.Toggled += (e) => { + if ((_menuItem != null && _menuItem.Parent != null && _ckbIsTopLevel.Checked) || + _menuItem == null && hasParent && _ckbIsTopLevel.Checked) { + MessageBox.ErrorQuery ("Invalid IsTopLevel", "Only menu bar can have top level menu item!", "Ok"); + _ckbIsTopLevel.Checked = false; + return; + } + if (_ckbIsTopLevel.Checked) { + _ckbSubMenu.Checked = false; + _ckbSubMenu.SetNeedsDisplay (); + _txtHelp.Enabled = true; + _txtAction.Enabled = true; + _txtShortcut.Enabled = !_ckbIsTopLevel.Checked && !_ckbSubMenu.Checked; + } else { + if (_menuItem == null && !hasParent || _menuItem.Parent == null) { + _ckbSubMenu.Checked = true; + _ckbSubMenu.SetNeedsDisplay (); + _txtShortcut.Enabled = false; + } + _txtHelp.Text = ""; + _txtHelp.Enabled = false; + _txtAction.Text = ""; + _txtAction.Enabled = false; + } + }; + _ckbSubMenu.Toggled += (e) => { + if (_ckbSubMenu.Checked) { + _ckbIsTopLevel.Checked = false; + _ckbIsTopLevel.SetNeedsDisplay (); + _txtHelp.Text = ""; + _txtHelp.Enabled = false; + _txtAction.Text = ""; + _txtAction.Enabled = false; + _txtShortcut.Text = ""; + _txtShortcut.Enabled = false; + } else { + if (!hasParent) { + _ckbIsTopLevel.Checked = true; + _ckbIsTopLevel.SetNeedsDisplay (); + _txtShortcut.Enabled = false; + } + _txtHelp.Enabled = true; + _txtAction.Enabled = true; + _txtShortcut.Enabled = !_ckbIsTopLevel.Checked && !_ckbSubMenu.Checked; + } + }; + + //Add (_frmMenuDetails); + + } + + + public DynamicMenuItem EnterMenuItem () + { + var valid = false; + + if (_menuItem == null) { + var m = new DynamicMenuItem (); + _txtTitle.Text = m.title; + _txtHelp.Text = m.help; + _txtAction.Text = m.action; + _ckbIsTopLevel.Checked = false; + _ckbSubMenu.Checked = !hasParent; + _txtHelp.Enabled = hasParent; + _txtAction.Enabled = hasParent; + _txtShortcut.Enabled = hasParent; + } else { + EditMenuBarItem (_menuItem); } - var finalValue = valueConverter?.Convert (sourceValue) ?? sourceValue; + var _btnOk = new Button ("Ok") { + IsDefault = true, + }; + _btnOk.Clicked += () => { + if (ustring.IsNullOrEmpty (_txtTitle.Text)) { + MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); + } else { + valid = true; + Application.RequestStop (); + } + }; + var _btnCancel = new Button ("Cancel"); + _btnCancel.Clicked += () => { + _txtTitle.Text = ustring.Empty; + Application.RequestStop (); + }; + var _dialog = new Dialog ("Please enter the menu details.", _btnOk, _btnCancel); - var targetProperty = Target.GetType ().GetProperty (TargetPropertyName); - targetProperty.SetValue (Target, finalValue); - } catch (Exception ex) { - MessageBox.ErrorQuery ("Binding Error", $"Binding failed: {ex}.", "Ok"); + Width = Dim.Fill (); + Height = Dim.Fill () - 1; + _dialog.Add (this); + _txtTitle.SetFocus (); + _txtTitle.CursorPosition = _txtTitle.Text.Length; + Application.Run (_dialog); + + if (valid) { + return new DynamicMenuItem (_txtTitle.Text, _txtHelp.Text, _txtAction.Text, + _ckbIsTopLevel != null ? _ckbIsTopLevel.Checked : false, + _ckbSubMenu != null ? _ckbSubMenu.Checked : false, + _rbChkStyle.SelectedItem == 0 ? MenuItemCheckStyle.NoCheck : + _rbChkStyle.SelectedItem == 1 ? MenuItemCheckStyle.Checked : MenuItemCheckStyle.Radio, + _txtShortcut.Text); + } else { + return null; + } + } + + public void EditMenuBarItem (MenuItem menuItem) + { + if (menuItem == null) { + hasParent = false; + Enabled = false; + CleanEditMenuBarItem (); + return; + } else { + hasParent = menuItem.Parent != null; + Enabled = true; + } + _menuItem = menuItem; + _txtTitle.Text = menuItem?.Title ?? ""; + _txtHelp.Text = menuItem?.Help ?? ""; + _txtAction.Text = menuItem != null && menuItem.Action != null ? GetTargetAction (menuItem.Action) : ustring.Empty; + _ckbIsTopLevel.Checked = IsTopLevel (menuItem); + _ckbSubMenu.Checked = HasSubMenus (menuItem); + _txtHelp.Enabled = !_ckbSubMenu.Checked; + _txtAction.Enabled = !_ckbSubMenu.Checked; + _rbChkStyle.SelectedItem = (int)(menuItem?.CheckType ?? MenuItemCheckStyle.NoCheck); + _txtShortcut.Text = menuItem?.ShortcutTag ?? ""; + _txtShortcut.Enabled = !_ckbIsTopLevel.Checked && !_ckbSubMenu.Checked; + } + + void CleanEditMenuBarItem () + { + _txtTitle.Text = ""; + _txtHelp.Text = ""; + _txtAction.Text = ""; + _ckbIsTopLevel.Checked = false; + _ckbSubMenu.Checked = false; + _rbChkStyle.SelectedItem = (int)MenuItemCheckStyle.NoCheck; + _txtShortcut.Text = ""; + } + + ustring GetTargetAction (Action action) + { + var me = action.Target; + + if (me == null) { + throw new ArgumentException (); + } + object v = new object (); + foreach (var field in me.GetType ().GetFields ()) { + if (field.Name == "item") { + v = field.GetValue (me); + } + } + return v == null || !(v is DynamicMenuItem item) ? ustring.Empty : item.action; + } + + bool IsTopLevel (MenuItem menuItem) + { + var topLevel = menuItem as MenuBarItem; + if (topLevel != null && topLevel.Parent == null && (topLevel.Children == null || topLevel.Children.Length == 0) && topLevel.Action != null) { + return true; + } else { + return false; + } + } + + bool HasSubMenus (MenuItem menuItem) + { + var menuBarItem = menuItem as MenuBarItem; + if (menuBarItem != null && menuBarItem.Children != null && (menuBarItem.Children.Length > 0 || menuBarItem.Action == null)) { + return true; + } else { + return false; + } + } + + public Action CreateAction (MenuItem menuItem, DynamicMenuItem item) + { + switch (menuItem.CheckType) { + case MenuItemCheckStyle.NoCheck: + return new Action (() => MessageBox.ErrorQuery (item.title, item.action, "Ok")); + case MenuItemCheckStyle.Checked: + return new Action (() => menuItem.Checked = !menuItem.Checked); + case MenuItemCheckStyle.Radio: + break; + } + return new Action (() => { + menuItem.Checked = true; + var parent = menuItem?.Parent as MenuBarItem; + if (parent != null) { + var childrens = parent.Children; + for (int i = 0; i < childrens.Length; i++) { + var child = childrens [i]; + if (child != menuItem) { + child.Checked = false; + } + } + } + }); + } + + public void UpdateParent (ref MenuItem menuItem) + { + var parent = menuItem.Parent as MenuBarItem; + var idx = parent.GetChildrenIndex (menuItem); + if (!(menuItem is MenuBarItem)) { + menuItem = new MenuBarItem (menuItem.Title, new MenuItem [] { }, menuItem.Parent); + if (idx > -1) { + parent.Children [idx] = menuItem; + } + } else { + menuItem = new MenuItem (menuItem.Title, menuItem.Help, CreateAction (menuItem, new DynamicMenuItem ()), null, menuItem.Parent); + if (idx > -1) { + parent.Children [idx] = menuItem; + } + } } } - } - public class ListWrapperConverter : IValueConverter { - public object Convert (object value, object parameter = null) - { - return new ListWrapper ((IList)value); + public class DynamicMenuItemModel : INotifyPropertyChanged { + public event PropertyChangedEventHandler PropertyChanged; + + private ustring menuBar; + private ustring parent; + private List menus; + + public ustring MenuBar { + get => menuBar; + set { + if (value != menuBar) { + menuBar = value; + PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); + } + } + } + + public ustring Parent { + get => parent; + set { + if (value != parent) { + parent = value; + PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); + } + } + } + + public List Menus { + get => menus; + set { + if (value != menus) { + menus = value; + PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); + } + } + } + + public DynamicMenuItemModel () + { + Menus = new List (); + } + + public string GetPropertyName ([CallerMemberName] string propertyName = null) + { + return propertyName; + } } - } - public class UStringValueConverter : IValueConverter { - public object Convert (object value, object parameter = null) - { - var data = Encoding.ASCII.GetBytes (value.ToString ()); - return ustring.Make (data); + public interface IValueConverter { + object Convert (object value, object parameter = null); + } + + public class Binding { + public View Target { get; private set; } + public View Source { get; private set; } + + public string SourcePropertyName { get; private set; } + public string TargetPropertyName { get; private set; } + + private object sourceDataContext; + private PropertyInfo sourceBindingProperty; + private IValueConverter valueConverter; + + public Binding (View source, string sourcePropertyName, View target, string targetPropertyName, IValueConverter valueConverter = null) + { + Target = target; + Source = source; + SourcePropertyName = sourcePropertyName; + TargetPropertyName = targetPropertyName; + sourceDataContext = Source.GetType ().GetProperty ("DataContext").GetValue (Source); + sourceBindingProperty = sourceDataContext.GetType ().GetProperty (SourcePropertyName); + this.valueConverter = valueConverter; + UpdateTarget (); + + var notifier = ((INotifyPropertyChanged)sourceDataContext); + if (notifier != null) { + notifier.PropertyChanged += (s, e) => { + if (e.PropertyName == SourcePropertyName) { + UpdateTarget (); + } + }; + } + } + + private void UpdateTarget () + { + try { + var sourceValue = sourceBindingProperty.GetValue (sourceDataContext); + if (sourceValue == null) { + return; + } + + var finalValue = valueConverter?.Convert (sourceValue) ?? sourceValue; + + var targetProperty = Target.GetType ().GetProperty (TargetPropertyName); + targetProperty.SetValue (Target, finalValue); + } catch (Exception ex) { + MessageBox.ErrorQuery ("Binding Error", $"Binding failed: {ex}.", "Ok"); + } + } + } + + public class ListWrapperConverter : IValueConverter { + public object Convert (object value, object parameter = null) + { + return new ListWrapper ((IList)value); + } + } + + public class UStringValueConverter : IValueConverter { + public object Convert (object value, object parameter = null) + { + var data = Encoding.ASCII.GetBytes (value.ToString ()); + return ustring.Make (data); + } } } } diff --git a/UICatalog/Scenarios/DynamicStatusBar.cs b/UICatalog/Scenarios/DynamicStatusBar.cs index 474f5fac0..43e64188f 100644 --- a/UICatalog/Scenarios/DynamicStatusBar.cs +++ b/UICatalog/Scenarios/DynamicStatusBar.cs @@ -1,595 +1,667 @@ using NStack; using System; +using System.Collections; using System.Collections.Generic; using System.ComponentModel; +using System.Reflection; using System.Runtime.CompilerServices; +using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Dynamic StatusBar", Description: "Demonstrates how to add and remove a StatusBar and change items dynamically.")] [ScenarioCategory ("Dynamic")] - class DynamicStatusBar : Scenario { + public class DynamicStatusBar : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { Application.Init (); - Top = Application.Top; + Top = Application.Top; Top.Add (new DynamicStatusBarSample ($"CTRL-Q to Close - Scenario: {GetName ()}")); } - } - public class DynamicStatusItemList { - public ustring Title { get; set; } - public StatusItem StatusItem { get; set; } + public class DynamicStatusItemList { + public ustring Title { get; set; } + public StatusItem StatusItem { get; set; } - public DynamicStatusItemList () { } + public DynamicStatusItemList () { } - public DynamicStatusItemList (ustring title, StatusItem statusItem) - { - Title = title; - StatusItem = statusItem; + public DynamicStatusItemList (ustring title, StatusItem statusItem) + { + Title = title; + StatusItem = statusItem; + } + + public override string ToString () => $"{Title}, {StatusItem}"; } - public override string ToString () => $"{Title}, {StatusItem}"; - } + public class DynamicStatusItem { + public ustring title = "New"; + public ustring action = ""; + public ustring shortcut; - public class DynamicStatusItem { - public ustring title = "New"; - public ustring action = ""; - public ustring shortcut; + public DynamicStatusItem () { } - public DynamicStatusItem () { } + public DynamicStatusItem (ustring title) + { + this.title = title; + } - public DynamicStatusItem (ustring title) - { - this.title = title; + public DynamicStatusItem (ustring title, ustring action, ustring shortcut = null) + { + this.title = title; + this.action = action; + this.shortcut = shortcut; + } } - public DynamicStatusItem (ustring title, ustring action, ustring shortcut = null) - { - this.title = title; - this.action = action; - this.shortcut = shortcut; - } - } + public class DynamicStatusBarSample : Window { + StatusBar _statusBar; + StatusItem _currentStatusItem; + int _currentSelectedStatusBar = -1; + StatusItem _currentEditStatusItem; + ListView _lstItems; - public class DynamicStatusBarSample : Window { - StatusBar _statusBar; - StatusItem _currentStatusItem; - int _currentSelectedStatusBar = -1; - StatusItem _currentEditStatusItem; - ListView _lstItems; + public DynamicStatusItemModel DataContext { get; set; } - public DynamicStatusItemModel DataContext { get; set; } + public DynamicStatusBarSample (ustring title) : base (title) + { + DataContext = new DynamicStatusItemModel (); - public DynamicStatusBarSample (ustring title) : base (title) - { - DataContext = new DynamicStatusItemModel (); + var _frmDelimiter = new FrameView ("Shortcut Delimiter:") { + X = Pos.Center (), + Y = 0, + Width = 25, + Height = 4 + }; - var _frmDelimiter = new FrameView ("Shortcut Delimiter:") { - X = Pos.Center (), - Y = 0, - Width = 25, - Height = 4 - }; + var _txtDelimiter = new TextField (StatusBar.ShortcutDelimiter.ToString ()) { + X = Pos.Center (), + Width = 2, + }; + _txtDelimiter.TextChanged += (_) => StatusBar.ShortcutDelimiter = _txtDelimiter.Text; + _frmDelimiter.Add (_txtDelimiter); - var _txtDelimiter = new TextField (StatusBar.ShortcutDelimiter.ToString ()) { - X = Pos.Center (), - Width = 2, - }; - _txtDelimiter.TextChanged += (_) => StatusBar.ShortcutDelimiter = _txtDelimiter.Text; - _frmDelimiter.Add (_txtDelimiter); + Add (_frmDelimiter); - Add (_frmDelimiter); + var _frmStatusBar = new FrameView ("Items:") { + Y = 5, + Width = Dim.Percent (50), + Height = Dim.Fill (2) + }; - var _frmStatusBar = new FrameView ("Items:") { - Y = 5, - Width = Dim.Percent (50), - Height = Dim.Fill (2) - }; + var _btnAddStatusBar = new Button ("Add a StatusBar") { + Y = 1, + }; + _frmStatusBar.Add (_btnAddStatusBar); - var _btnAddStatusBar = new Button ("Add a StatusBar") { - Y = 1, - }; - _frmStatusBar.Add (_btnAddStatusBar); + var _btnRemoveStatusBar = new Button ("Remove a StatusBar") { + Y = 1 + }; + _btnRemoveStatusBar.X = Pos.AnchorEnd () - (Pos.Right (_btnRemoveStatusBar) - Pos.Left (_btnRemoveStatusBar)); + _frmStatusBar.Add (_btnRemoveStatusBar); - var _btnRemoveStatusBar = new Button ("Remove a StatusBar") { - Y = 1 - }; - _btnRemoveStatusBar.X = Pos.AnchorEnd () - (Pos.Right (_btnRemoveStatusBar) - Pos.Left (_btnRemoveStatusBar)); - _frmStatusBar.Add (_btnRemoveStatusBar); + var _btnAdd = new Button (" Add ") { + Y = Pos.Top (_btnRemoveStatusBar) + 2, + }; + _btnAdd.X = Pos.AnchorEnd () - (Pos.Right (_btnAdd) - Pos.Left (_btnAdd)); + _frmStatusBar.Add (_btnAdd); - var _btnAdd = new Button (" Add ") { - Y = Pos.Top (_btnRemoveStatusBar) + 2, - }; - _btnAdd.X = Pos.AnchorEnd () - (Pos.Right (_btnAdd) - Pos.Left (_btnAdd)); - _frmStatusBar.Add (_btnAdd); + _lstItems = new ListView (new List ()) { + ColorScheme = Colors.Dialog, + Y = Pos.Top (_btnAddStatusBar) + 2, + Width = Dim.Fill () - Dim.Width (_btnAdd) - 1, + Height = Dim.Fill (), + }; + _frmStatusBar.Add (_lstItems); - _lstItems = new ListView (new List ()) { - ColorScheme = Colors.Dialog, - Y = Pos.Top (_btnAddStatusBar) + 2, - Width = Dim.Fill () - Dim.Width (_btnAdd) - 1, - Height = Dim.Fill (), - }; - _frmStatusBar.Add (_lstItems); + var _btnRemove = new Button ("Remove") { + X = Pos.Left (_btnAdd), + Y = Pos.Top (_btnAdd) + 1 + }; + _frmStatusBar.Add (_btnRemove); - var _btnRemove = new Button ("Remove") { - X = Pos.Left (_btnAdd), - Y = Pos.Top (_btnAdd) + 1 - }; - _frmStatusBar.Add (_btnRemove); + var _btnUp = new Button ("^") { + X = Pos.Right (_lstItems) + 2, + Y = Pos.Top (_btnRemove) + 2 + }; + _frmStatusBar.Add (_btnUp); - var _btnUp = new Button ("^") { - X = Pos.Right (_lstItems) + 2, - Y = Pos.Top (_btnRemove) + 2 - }; - _frmStatusBar.Add (_btnUp); + var _btnDown = new Button ("v") { + X = Pos.Right (_lstItems) + 2, + Y = Pos.Top (_btnUp) + 1 + }; + _frmStatusBar.Add (_btnDown); - var _btnDown = new Button ("v") { - X = Pos.Right (_lstItems) + 2, - Y = Pos.Top (_btnUp) + 1 - }; - _frmStatusBar.Add (_btnDown); - - Add (_frmStatusBar); + Add (_frmStatusBar); - var _frmStatusBarDetails = new DynamicStatusBarDetails ("StatusBar Item Details:") { - X = Pos.Right (_frmStatusBar), - Y = Pos.Top (_frmStatusBar), - Width = Dim.Fill (), - Height = Dim.Fill (4) - }; - Add (_frmStatusBarDetails); + var _frmStatusBarDetails = new DynamicStatusBarDetails ("StatusBar Item Details:") { + X = Pos.Right (_frmStatusBar), + Y = Pos.Top (_frmStatusBar), + Width = Dim.Fill (), + Height = Dim.Fill (4) + }; + Add (_frmStatusBarDetails); - _btnUp.Clicked += () => { - var i = _lstItems.SelectedItem; - var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null; - if (statusItem != null) { - var items = _statusBar.Items; - if (i > 0) { - items [i] = items [i - 1]; - items [i - 1] = statusItem; - DataContext.Items [i] = DataContext.Items [i - 1]; - DataContext.Items [i - 1] = new DynamicStatusItemList (statusItem.Title, statusItem); - _lstItems.SelectedItem = i - 1; - _statusBar.SetNeedsDisplay (); + _btnUp.Clicked += () => { + var i = _lstItems.SelectedItem; + var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null; + if (statusItem != null) { + var items = _statusBar.Items; + if (i > 0) { + items [i] = items [i - 1]; + items [i - 1] = statusItem; + DataContext.Items [i] = DataContext.Items [i - 1]; + DataContext.Items [i - 1] = new DynamicStatusItemList (statusItem.Title, statusItem); + _lstItems.SelectedItem = i - 1; + _statusBar.SetNeedsDisplay (); + } } - } - }; + }; - _btnDown.Clicked += () => { - var i = _lstItems.SelectedItem; - var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null; - if (statusItem != null) { - var items = _statusBar.Items; - if (i < items.Length - 1) { - items [i] = items [i + 1]; - items [i + 1] = statusItem; - DataContext.Items [i] = DataContext.Items [i + 1]; - DataContext.Items [i + 1] = new DynamicStatusItemList (statusItem.Title, statusItem); - _lstItems.SelectedItem = i + 1; - _statusBar.SetNeedsDisplay (); + _btnDown.Clicked += () => { + var i = _lstItems.SelectedItem; + var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [i].StatusItem : null; + if (statusItem != null) { + var items = _statusBar.Items; + if (i < items.Length - 1) { + items [i] = items [i + 1]; + items [i + 1] = statusItem; + DataContext.Items [i] = DataContext.Items [i + 1]; + DataContext.Items [i + 1] = new DynamicStatusItemList (statusItem.Title, statusItem); + _lstItems.SelectedItem = i + 1; + _statusBar.SetNeedsDisplay (); + } } - } - }; + }; - var _btnOk = new Button ("Ok") { - X = Pos.Right (_frmStatusBar) + 20, - Y = Pos.Bottom (_frmStatusBarDetails), - }; - Add (_btnOk); + var _btnOk = new Button ("Ok") { + X = Pos.Right (_frmStatusBar) + 20, + Y = Pos.Bottom (_frmStatusBarDetails), + }; + Add (_btnOk); - var _btnCancel = new Button ("Cancel") { - X = Pos.Right (_btnOk) + 3, - Y = Pos.Top (_btnOk), - }; - _btnCancel.Clicked += () => { - SetFrameDetails (_currentEditStatusItem); - }; - Add (_btnCancel); + var _btnCancel = new Button ("Cancel") { + X = Pos.Right (_btnOk) + 3, + Y = Pos.Top (_btnOk), + }; + _btnCancel.Clicked += () => { + SetFrameDetails (_currentEditStatusItem); + }; + Add (_btnCancel); - _lstItems.SelectedItemChanged += (e) => { - SetFrameDetails (); - }; - - _btnOk.Clicked += () => { - if (ustring.IsNullOrEmpty (_frmStatusBarDetails._txtTitle.Text) && _currentEditStatusItem != null) { - MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); - } else if (_currentEditStatusItem != null) { - _frmStatusBarDetails._txtTitle.Text = SetTitleText ( - _frmStatusBarDetails._txtTitle.Text, _frmStatusBarDetails._txtShortcut.Text); - var statusItem = new DynamicStatusItem (_frmStatusBarDetails._txtTitle.Text, - _frmStatusBarDetails._txtAction.Text, - _frmStatusBarDetails._txtShortcut.Text); - UpdateStatusItem (_currentEditStatusItem, statusItem, _lstItems.SelectedItem); - } - }; - - _btnAdd.Clicked += () => { - if (StatusBar == null) { - MessageBox.ErrorQuery ("StatusBar Bar Error", "Must add a StatusBar first!", "Ok"); - _btnAddStatusBar.SetFocus (); - return; - } - - var frameDetails = new DynamicStatusBarDetails (); - var item = frameDetails.EnterStatusItem (); - if (item == null) { - return; - } - - StatusItem newStatusItem = CreateNewStatusBar (item); - _currentSelectedStatusBar++; - _statusBar.AddItemAt (_currentSelectedStatusBar, newStatusItem); - DataContext.Items.Add (new DynamicStatusItemList (newStatusItem.Title, newStatusItem)); - _lstItems.MoveDown (); - SetFrameDetails (); - }; - - _btnRemove.Clicked += () => { - var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; - if (statusItem != null) { - _statusBar.RemoveItem (_currentSelectedStatusBar); - DataContext.Items.RemoveAt (_lstItems.SelectedItem); - if (_lstItems.Source.Count > 0 && _lstItems.SelectedItem > _lstItems.Source.Count - 1) { - _lstItems.SelectedItem = _lstItems.Source.Count - 1; - } - _lstItems.SetNeedsDisplay (); + _lstItems.SelectedItemChanged += (e) => { SetFrameDetails (); - } - }; + }; - _lstItems.Enter += (_) => { - var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; - SetFrameDetails (statusItem); - }; + _btnOk.Clicked += () => { + if (ustring.IsNullOrEmpty (_frmStatusBarDetails._txtTitle.Text) && _currentEditStatusItem != null) { + MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); + } else if (_currentEditStatusItem != null) { + _frmStatusBarDetails._txtTitle.Text = SetTitleText ( + _frmStatusBarDetails._txtTitle.Text, _frmStatusBarDetails._txtShortcut.Text); + var statusItem = new DynamicStatusItem (_frmStatusBarDetails._txtTitle.Text, + _frmStatusBarDetails._txtAction.Text, + _frmStatusBarDetails._txtShortcut.Text); + UpdateStatusItem (_currentEditStatusItem, statusItem, _lstItems.SelectedItem); + } + }; - _btnAddStatusBar.Clicked += () => { - if (_statusBar != null) { - return; - } + _btnAdd.Clicked += () => { + if (StatusBar == null) { + MessageBox.ErrorQuery ("StatusBar Bar Error", "Must add a StatusBar first!", "Ok"); + _btnAddStatusBar.SetFocus (); + return; + } - _statusBar = new StatusBar (); - Add (_statusBar); - }; + var frameDetails = new DynamicStatusBarDetails (); + var item = frameDetails.EnterStatusItem (); + if (item == null) { + return; + } - _btnRemoveStatusBar.Clicked += () => { - if (_statusBar == null) { - return; - } + StatusItem newStatusItem = CreateNewStatusBar (item); + _currentSelectedStatusBar++; + _statusBar.AddItemAt (_currentSelectedStatusBar, newStatusItem); + DataContext.Items.Add (new DynamicStatusItemList (newStatusItem.Title, newStatusItem)); + _lstItems.MoveDown (); + SetFrameDetails (); + }; - Remove (_statusBar); - _statusBar = null; - DataContext.Items = new List (); - _currentStatusItem = null; - _currentSelectedStatusBar = -1; - SetListViewSource (_currentStatusItem, true); - SetFrameDetails (null); - }; + _btnRemove.Clicked += () => { + var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; + if (statusItem != null) { + _statusBar.RemoveItem (_currentSelectedStatusBar); + DataContext.Items.RemoveAt (_lstItems.SelectedItem); + if (_lstItems.Source.Count > 0 && _lstItems.SelectedItem > _lstItems.Source.Count - 1) { + _lstItems.SelectedItem = _lstItems.Source.Count - 1; + } + _lstItems.SetNeedsDisplay (); + SetFrameDetails (); + } + }; + + _lstItems.Enter += (_) => { + var statusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; + SetFrameDetails (statusItem); + }; + + _btnAddStatusBar.Clicked += () => { + if (_statusBar != null) { + return; + } + + _statusBar = new StatusBar (); + Add (_statusBar); + }; + + _btnRemoveStatusBar.Clicked += () => { + if (_statusBar == null) { + return; + } + + Remove (_statusBar); + _statusBar = null; + DataContext.Items = new List (); + _currentStatusItem = null; + _currentSelectedStatusBar = -1; + SetListViewSource (_currentStatusItem, true); + SetFrameDetails (null); + }; - SetFrameDetails (); + SetFrameDetails (); - var ustringConverter = new UStringValueConverter (); - var listWrapperConverter = new ListWrapperConverter (); + var ustringConverter = new UStringValueConverter (); + var listWrapperConverter = new ListWrapperConverter (); - var lstItems = new Binding (this, "Items", _lstItems, "Source", listWrapperConverter); + var lstItems = new Binding (this, "Items", _lstItems, "Source", listWrapperConverter); - void SetFrameDetails (StatusItem statusItem = null) - { - StatusItem newStatusItem; + void SetFrameDetails (StatusItem statusItem = null) + { + StatusItem newStatusItem; - if (statusItem == null) { - newStatusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; - } else { - newStatusItem = statusItem; - } + if (statusItem == null) { + newStatusItem = DataContext.Items.Count > 0 ? DataContext.Items [_lstItems.SelectedItem].StatusItem : null; + } else { + newStatusItem = statusItem; + } - _currentEditStatusItem = newStatusItem; - _frmStatusBarDetails.EditStatusItem (newStatusItem); - var f = _btnOk.Enabled == _frmStatusBarDetails.Enabled; - if (!f) { - _btnOk.Enabled = _frmStatusBarDetails.Enabled; - _btnCancel.Enabled = _frmStatusBarDetails.Enabled; - } - } - - void SetListViewSource (StatusItem _currentStatusItem, bool fill = false) - { - DataContext.Items = new List (); - var statusItem = _currentStatusItem; - if (!fill) { - return; - } - if (statusItem != null) { - foreach (var si in _statusBar.Items) { - DataContext.Items.Add (new DynamicStatusItemList (si.Title, si)); + _currentEditStatusItem = newStatusItem; + _frmStatusBarDetails.EditStatusItem (newStatusItem); + var f = _btnOk.Enabled == _frmStatusBarDetails.Enabled; + if (!f) { + _btnOk.Enabled = _frmStatusBarDetails.Enabled; + _btnCancel.Enabled = _frmStatusBarDetails.Enabled; } } - } - StatusItem CreateNewStatusBar (DynamicStatusItem item) - { - var newStatusItem = new StatusItem (ShortcutHelper.GetShortcutFromTag ( - item.shortcut, StatusBar.ShortcutDelimiter), - item.title, _frmStatusBarDetails.CreateAction (item)); - - return newStatusItem; - } - - void UpdateStatusItem (StatusItem _currentEditStatusItem, DynamicStatusItem statusItem, int index) - { - _currentEditStatusItem = CreateNewStatusBar (statusItem); - _statusBar.Items [index] = _currentEditStatusItem; - if (DataContext.Items.Count == 0) { - DataContext.Items.Add (new DynamicStatusItemList (_currentEditStatusItem.Title, _currentEditStatusItem)); + void SetListViewSource (StatusItem _currentStatusItem, bool fill = false) + { + DataContext.Items = new List (); + var statusItem = _currentStatusItem; + if (!fill) { + return; + } + if (statusItem != null) { + foreach (var si in _statusBar.Items) { + DataContext.Items.Add (new DynamicStatusItemList (si.Title, si)); + } + } } - DataContext.Items [index] = new DynamicStatusItemList (_currentEditStatusItem.Title, _currentEditStatusItem); - SetFrameDetails (_currentEditStatusItem); + + StatusItem CreateNewStatusBar (DynamicStatusItem item) + { + var newStatusItem = new StatusItem (ShortcutHelper.GetShortcutFromTag ( + item.shortcut, StatusBar.ShortcutDelimiter), + item.title, _frmStatusBarDetails.CreateAction (item)); + + return newStatusItem; + } + + void UpdateStatusItem (StatusItem _currentEditStatusItem, DynamicStatusItem statusItem, int index) + { + _currentEditStatusItem = CreateNewStatusBar (statusItem); + _statusBar.Items [index] = _currentEditStatusItem; + if (DataContext.Items.Count == 0) { + DataContext.Items.Add (new DynamicStatusItemList (_currentEditStatusItem.Title, _currentEditStatusItem)); + } + DataContext.Items [index] = new DynamicStatusItemList (_currentEditStatusItem.Title, _currentEditStatusItem); + SetFrameDetails (_currentEditStatusItem); + } + + + //_frmStatusBarDetails.Initialized += (s, e) => _frmStatusBarDetails.Enabled = false; } + public static ustring SetTitleText (ustring title, ustring shortcut) + { + var txt = title; + var split = title.ToString ().Split ('~'); + if (split.Length > 1) { + txt = split [2].Trim (); ; + } + if (string.IsNullOrEmpty (shortcut.ToString ())) { + return txt; + } - //_frmStatusBarDetails.Initialized += (s, e) => _frmStatusBarDetails.Enabled = false; + return $"~{shortcut}~ {txt}"; + } } - public static ustring SetTitleText (ustring title, ustring shortcut) - { - var txt = title; - var split = title.ToString ().Split ('~'); - if (split.Length > 1) { - txt = split [2].Trim (); ; - } - if (string.IsNullOrEmpty (shortcut.ToString ())) { - return txt; - } + public class DynamicStatusBarDetails : FrameView { + public StatusItem _statusItem; + public TextField _txtTitle; + public TextView _txtAction; + public TextField _txtShortcut; - return $"~{shortcut}~ {txt}"; - } - } - - public class DynamicStatusBarDetails : FrameView { - public StatusItem _statusItem; - public TextField _txtTitle; - public TextView _txtAction; - public TextField _txtShortcut; - - public DynamicStatusBarDetails (StatusItem statusItem = null) : this (statusItem == null ? "Adding New StatusBar Item." : "Editing StatusBar Item.") - { - _statusItem = statusItem; - } - - public DynamicStatusBarDetails (ustring title) : base (title) - { - var _lblTitle = new Label ("Title:") { - Y = 1 - }; - Add (_lblTitle); - - _txtTitle = new TextField () { - X = Pos.Right (_lblTitle) + 4, - Y = Pos.Top (_lblTitle), - Width = Dim.Fill () - }; - Add (_txtTitle); - - var _lblAction = new Label ("Action:") { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_lblTitle) + 1 - }; - Add (_lblAction); - - _txtAction = new TextView () { - ColorScheme = Colors.Dialog, - X = Pos.Left (_txtTitle), - Y = Pos.Top (_lblAction), - Width = Dim.Fill (), - Height = 5 - }; - Add (_txtAction); - - var _lblShortcut = new Label ("Shortcut:") { - X = Pos.Left (_lblTitle), - Y = Pos.Bottom (_txtAction) + 1 - }; - Add (_lblShortcut); - - _txtShortcut = new TextField () { - X = Pos.X (_txtAction), - Y = Pos.Y (_lblShortcut), - Width = Dim.Fill (), - ReadOnly = true - }; - _txtShortcut.KeyDown += (e) => { - if (!ProcessKey (e.KeyEvent)) { - return; - } - - var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); - if (CheckShortcut (k, true)) { - e.Handled = true; - } - }; - - bool ProcessKey (KeyEvent ev) + public DynamicStatusBarDetails (StatusItem statusItem = null) : this (statusItem == null ? "Adding New StatusBar Item." : "Editing StatusBar Item.") { - switch (ev.Key) { - case Key.CursorUp: - case Key.CursorDown: - case Key.Tab: - case Key.BackTab: - return false; - } - - return true; + _statusItem = statusItem; } - bool CheckShortcut (Key k, bool pre) + public DynamicStatusBarDetails (ustring title) : base (title) { - var m = _statusItem != null ? _statusItem : new StatusItem (k, "", null); - if (pre && !ShortcutHelper.PreShortcutValidation (k)) { - _txtShortcut.Text = ""; - return false; + var _lblTitle = new Label ("Title:") { + Y = 1 + }; + Add (_lblTitle); + + _txtTitle = new TextField () { + X = Pos.Right (_lblTitle) + 4, + Y = Pos.Top (_lblTitle), + Width = Dim.Fill () + }; + Add (_txtTitle); + + var _lblAction = new Label ("Action:") { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_lblTitle) + 1 + }; + Add (_lblAction); + + _txtAction = new TextView () { + ColorScheme = Colors.Dialog, + X = Pos.Left (_txtTitle), + Y = Pos.Top (_lblAction), + Width = Dim.Fill (), + Height = 5 + }; + Add (_txtAction); + + var _lblShortcut = new Label ("Shortcut:") { + X = Pos.Left (_lblTitle), + Y = Pos.Bottom (_txtAction) + 1 + }; + Add (_lblShortcut); + + _txtShortcut = new TextField () { + X = Pos.X (_txtAction), + Y = Pos.Y (_lblShortcut), + Width = Dim.Fill (), + ReadOnly = true + }; + _txtShortcut.KeyDown += (e) => { + if (!ProcessKey (e.KeyEvent)) { + return; + } + + var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); + if (CheckShortcut (k, true)) { + e.Handled = true; + } + }; + + bool ProcessKey (KeyEvent ev) + { + switch (ev.Key) { + case Key.CursorUp: + case Key.CursorDown: + case Key.Tab: + case Key.BackTab: + return false; + } + + return true; } - if (!pre) { - if (!ShortcutHelper.PostShortcutValidation (ShortcutHelper.GetShortcutFromTag ( - _txtShortcut.Text, StatusBar.ShortcutDelimiter))) { + + bool CheckShortcut (Key k, bool pre) + { + var m = _statusItem != null ? _statusItem : new StatusItem (k, "", null); + if (pre && !ShortcutHelper.PreShortcutValidation (k)) { _txtShortcut.Text = ""; return false; } + if (!pre) { + if (!ShortcutHelper.PostShortcutValidation (ShortcutHelper.GetShortcutFromTag ( + _txtShortcut.Text, StatusBar.ShortcutDelimiter))) { + _txtShortcut.Text = ""; + return false; + } + return true; + } + _txtShortcut.Text = ShortcutHelper.GetShortcutTag (k, StatusBar.ShortcutDelimiter); + return true; } - _txtShortcut.Text = ShortcutHelper.GetShortcutTag (k, StatusBar.ShortcutDelimiter); - return true; - } - - _txtShortcut.KeyUp += (e) => { - var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); - if (CheckShortcut (k, false)) { - e.Handled = true; - } - }; - Add (_txtShortcut); - - var _btnShortcut = new Button ("Clear Shortcut") { - X = Pos.X (_lblShortcut), - Y = Pos.Bottom (_txtShortcut) + 1 - }; - _btnShortcut.Clicked += () => { - _txtShortcut.Text = ""; - }; - Add (_btnShortcut); - } - - - public DynamicStatusItem EnterStatusItem () - { - var valid = false; - - if (_statusItem == null) { - var m = new DynamicStatusItem (); - _txtTitle.Text = m.title; - _txtAction.Text = m.action; - } else { - EditStatusItem (_statusItem); - } - - var _btnOk = new Button ("Ok") { - IsDefault = true, - }; - _btnOk.Clicked += () => { - if (ustring.IsNullOrEmpty (_txtTitle.Text)) { - MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); - } else { - if (!ustring.IsNullOrEmpty (_txtShortcut.Text)) { - _txtTitle.Text = DynamicStatusBarSample.SetTitleText ( - _txtTitle.Text, _txtShortcut.Text); + _txtShortcut.KeyUp += (e) => { + var k = ShortcutHelper.GetModifiersKey (e.KeyEvent); + if (CheckShortcut (k, false)) { + e.Handled = true; } - valid = true; + }; + Add (_txtShortcut); + + var _btnShortcut = new Button ("Clear Shortcut") { + X = Pos.X (_lblShortcut), + Y = Pos.Bottom (_txtShortcut) + 1 + }; + _btnShortcut.Clicked += () => { + _txtShortcut.Text = ""; + }; + Add (_btnShortcut); + } + + + public DynamicStatusItem EnterStatusItem () + { + var valid = false; + + if (_statusItem == null) { + var m = new DynamicStatusItem (); + _txtTitle.Text = m.title; + _txtAction.Text = m.action; + } else { + EditStatusItem (_statusItem); + } + + var _btnOk = new Button ("Ok") { + IsDefault = true, + }; + _btnOk.Clicked += () => { + if (ustring.IsNullOrEmpty (_txtTitle.Text)) { + MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok"); + } else { + if (!ustring.IsNullOrEmpty (_txtShortcut.Text)) { + _txtTitle.Text = DynamicStatusBarSample.SetTitleText ( + _txtTitle.Text, _txtShortcut.Text); + } + valid = true; + Application.RequestStop (); + } + }; + var _btnCancel = new Button ("Cancel"); + _btnCancel.Clicked += () => { + _txtTitle.Text = ustring.Empty; Application.RequestStop (); - } - }; - var _btnCancel = new Button ("Cancel"); - _btnCancel.Clicked += () => { - _txtTitle.Text = ustring.Empty; - Application.RequestStop (); - }; - var _dialog = new Dialog ("Please enter the item details.", _btnOk, _btnCancel); + }; + var _dialog = new Dialog ("Please enter the item details.", _btnOk, _btnCancel); - Width = Dim.Fill (); - Height = Dim.Fill () - 1; - _dialog.Add (this); - _txtTitle.SetFocus (); - _txtTitle.CursorPosition = _txtTitle.Text.Length; - Application.Run (_dialog); + Width = Dim.Fill (); + Height = Dim.Fill () - 1; + _dialog.Add (this); + _txtTitle.SetFocus (); + _txtTitle.CursorPosition = _txtTitle.Text.Length; + Application.Run (_dialog); - if (valid) { - return new DynamicStatusItem (_txtTitle.Text, _txtAction.Text, _txtShortcut.Text); - } else { - return null; - } - } - - public void EditStatusItem (StatusItem statusItem) - { - if (statusItem == null) { - Enabled = false; - CleanEditStatusItem (); - return; - } else { - Enabled = true; - } - _statusItem = statusItem; - _txtTitle.Text = statusItem?.Title ?? ""; - _txtAction.Text = statusItem != null && statusItem.Action != null ? GetTargetAction (statusItem.Action) : ustring.Empty; - _txtShortcut.Text = ShortcutHelper.GetShortcutTag (statusItem.Shortcut, StatusBar.ShortcutDelimiter) ?? ""; - } - - void CleanEditStatusItem () - { - _txtTitle.Text = ""; - _txtAction.Text = ""; - _txtShortcut.Text = ""; - } - - ustring GetTargetAction (Action action) - { - var me = action.Target; - - if (me == null) { - throw new ArgumentException (); - } - object v = new object (); - foreach (var field in me.GetType ().GetFields ()) { - if (field.Name == "item") { - v = field.GetValue (me); + if (valid) { + return new DynamicStatusItem (_txtTitle.Text, _txtAction.Text, _txtShortcut.Text); + } else { + return null; } } - return v == null || !(v is DynamicStatusItem item) ? ustring.Empty : item.action; + + public void EditStatusItem (StatusItem statusItem) + { + if (statusItem == null) { + Enabled = false; + CleanEditStatusItem (); + return; + } else { + Enabled = true; + } + _statusItem = statusItem; + _txtTitle.Text = statusItem?.Title ?? ""; + _txtAction.Text = statusItem != null && statusItem.Action != null ? GetTargetAction (statusItem.Action) : ustring.Empty; + _txtShortcut.Text = ShortcutHelper.GetShortcutTag (statusItem.Shortcut, StatusBar.ShortcutDelimiter) ?? ""; + } + + void CleanEditStatusItem () + { + _txtTitle.Text = ""; + _txtAction.Text = ""; + _txtShortcut.Text = ""; + } + + ustring GetTargetAction (Action action) + { + var me = action.Target; + + if (me == null) { + throw new ArgumentException (); + } + object v = new object (); + foreach (var field in me.GetType ().GetFields ()) { + if (field.Name == "item") { + v = field.GetValue (me); + } + } + return v == null || !(v is DynamicStatusItem item) ? ustring.Empty : item.action; + } + + public Action CreateAction (DynamicStatusItem item) + { + return new Action (() => MessageBox.ErrorQuery (item.title, item.action, "Ok")); + } } - public Action CreateAction (DynamicStatusItem item) - { - return new Action (() => MessageBox.ErrorQuery (item.title, item.action, "Ok")); + public class DynamicStatusItemModel : INotifyPropertyChanged { + public event PropertyChangedEventHandler PropertyChanged; + + private ustring statusBar; + private List items; + + public ustring StatusBar { + get => statusBar; + set { + if (value != statusBar) { + statusBar = value; + PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); + } + } + } + + public List Items { + get => items; + set { + if (value != items) { + items = value; + PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); + } + } + } + + public DynamicStatusItemModel () + { + Items = new List (); + } + + public string GetPropertyName ([CallerMemberName] string propertyName = null) + { + return propertyName; + } } - } - public class DynamicStatusItemModel : INotifyPropertyChanged { - public event PropertyChangedEventHandler PropertyChanged; + public interface IValueConverter { + object Convert (object value, object parameter = null); + } - private ustring statusBar; - private List items; + public class Binding { + public View Target { get; private set; } + public View Source { get; private set; } - public ustring StatusBar { - get => statusBar; - set { - if (value != statusBar) { - statusBar = value; - PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); + public string SourcePropertyName { get; private set; } + public string TargetPropertyName { get; private set; } + + private object sourceDataContext; + private PropertyInfo sourceBindingProperty; + private IValueConverter valueConverter; + + public Binding (View source, string sourcePropertyName, View target, string targetPropertyName, IValueConverter valueConverter = null) + { + Target = target; + Source = source; + SourcePropertyName = sourcePropertyName; + TargetPropertyName = targetPropertyName; + sourceDataContext = Source.GetType ().GetProperty ("DataContext").GetValue (Source); + sourceBindingProperty = sourceDataContext.GetType ().GetProperty (SourcePropertyName); + this.valueConverter = valueConverter; + UpdateTarget (); + + var notifier = ((INotifyPropertyChanged)sourceDataContext); + if (notifier != null) { + notifier.PropertyChanged += (s, e) => { + if (e.PropertyName == SourcePropertyName) { + UpdateTarget (); + } + }; + } + } + + private void UpdateTarget () + { + try { + var sourceValue = sourceBindingProperty.GetValue (sourceDataContext); + if (sourceValue == null) { + return; + } + + var finalValue = valueConverter?.Convert (sourceValue) ?? sourceValue; + + var targetProperty = Target.GetType ().GetProperty (TargetPropertyName); + targetProperty.SetValue (Target, finalValue); + } catch (Exception ex) { + MessageBox.ErrorQuery ("Binding Error", $"Binding failed: {ex}.", "Ok"); } } } - public List Items { - get => items; - set { - if (value != items) { - items = value; - PropertyChanged?.Invoke (this, new PropertyChangedEventArgs (GetPropertyName ())); - } + public class ListWrapperConverter : IValueConverter { + public object Convert (object value, object parameter = null) + { + return new ListWrapper ((IList)value); } } - public DynamicStatusItemModel () - { - Items = new List (); - } - - public string GetPropertyName ([CallerMemberName] string propertyName = null) - { - return propertyName; + public class UStringValueConverter : IValueConverter { + public object Convert (object value, object parameter = null) + { + var data = Encoding.ASCII.GetBytes (value.ToString ()); + return ustring.Make (data); + } } } } diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs index bd4621a61..9c3abb727 100644 --- a/UICatalog/Scenarios/Editor.cs +++ b/UICatalog/Scenarios/Editor.cs @@ -5,14 +5,14 @@ using Terminal.Gui; using System.Linq; using System.Text.RegularExpressions; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Editor", Description: "A Terminal.Gui Text Editor via TextView")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Dialogs")] [ScenarioCategory ("Text")] [ScenarioCategory ("Dialogs")] [ScenarioCategory ("TopLevel")] - class Editor : Scenario { + public class Editor : Scenario { private string _fileName = "demo.txt"; private TextView _textView; private bool _saved = true; diff --git a/UICatalog/Scenarios/Generic.cs b/UICatalog/Scenarios/Generic.cs index 248952876..478b46708 100644 --- a/UICatalog/Scenarios/Generic.cs +++ b/UICatalog/Scenarios/Generic.cs @@ -1,9 +1,9 @@ using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Generic", Description: "Generic sample - A template for creating new Scenarios")] [ScenarioCategory ("Controls")] - class MyScenario : Scenario { + public class MyScenario : Scenario { public override void Setup () { // Put your scenario code here, e.g. diff --git a/UICatalog/Scenarios/GraphViewExample.cs b/UICatalog/Scenarios/GraphViewExample.cs index c92faaeb0..f503e5b42 100644 --- a/UICatalog/Scenarios/GraphViewExample.cs +++ b/UICatalog/Scenarios/GraphViewExample.cs @@ -10,7 +10,7 @@ namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Graph View", Description: "Demos GraphView control")] [ScenarioCategory ("Controls")] - class GraphViewExample : Scenario { + public class GraphViewExample : Scenario { GraphView graphView; private TextView about; diff --git a/UICatalog/Scenarios/HexEditor.cs b/UICatalog/Scenarios/HexEditor.cs index 40bd7d724..f48b6c241 100644 --- a/UICatalog/Scenarios/HexEditor.cs +++ b/UICatalog/Scenarios/HexEditor.cs @@ -3,14 +3,14 @@ using System.IO; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "HexEditor", Description: "A Terminal.Gui binary (hex) editor via HexView")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Dialogs")] [ScenarioCategory ("Text")] [ScenarioCategory ("Dialogs")] [ScenarioCategory ("TopLevel")] - class HexEditor : Scenario { + public class HexEditor : Scenario { private string _fileName = "demo.bin"; private HexView _hexView; private bool _saved = true; diff --git a/UICatalog/Scenarios/InteractiveTree.cs b/UICatalog/Scenarios/InteractiveTree.cs index b01bc0399..04f04cd82 100644 --- a/UICatalog/Scenarios/InteractiveTree.cs +++ b/UICatalog/Scenarios/InteractiveTree.cs @@ -11,7 +11,7 @@ namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Interactive Tree", Description: "Create nodes and child nodes in TreeView")] [ScenarioCategory ("Controls")] - class InteractiveTree : Scenario { + public class InteractiveTree : Scenario { TreeView treeView; diff --git a/UICatalog/Scenarios/InvertColors.cs b/UICatalog/Scenarios/InvertColors.cs index 3e70a6ebc..a4e5a9528 100644 --- a/UICatalog/Scenarios/InvertColors.cs +++ b/UICatalog/Scenarios/InvertColors.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Invert Colors", Description: "Invert the foreground and the background colors.")] [ScenarioCategory ("Colors")] - class InvertColors : Scenario { + public class InvertColors : Scenario { public override void Setup () { Win.ColorScheme = Colors.TopLevel; diff --git a/UICatalog/Scenarios/Keys.cs b/UICatalog/Scenarios/Keys.cs index debc27c3e..6c3b60284 100644 --- a/UICatalog/Scenarios/Keys.cs +++ b/UICatalog/Scenarios/Keys.cs @@ -2,10 +2,10 @@ using System.Collections.Generic; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Keys", Description: "Shows how to handle keyboard input")] [ScenarioCategory ("Input")] - class Keys : Scenario { + public class Keys : Scenario { class TestWindow : Window { public List _processKeyList = new List (); diff --git a/UICatalog/Scenarios/LabelsAsButtons.cs b/UICatalog/Scenarios/LabelsAsButtons.cs index 0388b7b56..f8dac0c6b 100644 --- a/UICatalog/Scenarios/LabelsAsButtons.cs +++ b/UICatalog/Scenarios/LabelsAsButtons.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Reflection; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Labels As Buttons", Description: "Illustrates that Button is really just a Label++")] [ScenarioCategory ("Controls")] [ScenarioCategory ("POC")] - class LabelsAsLabels : Scenario { + public class LabelsAsLabels : Scenario { public override void Setup () { // Add a label & text field so we can demo IsDefault diff --git a/UICatalog/Scenarios/LineViewExample.cs b/UICatalog/Scenarios/LineViewExample.cs index f6216230e..fb06ffb4f 100644 --- a/UICatalog/Scenarios/LineViewExample.cs +++ b/UICatalog/Scenarios/LineViewExample.cs @@ -11,7 +11,7 @@ namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Line View", Description: "Demonstrates the LineView control")] [ScenarioCategory ("Controls")] - class LineViewExample : Scenario { + public class LineViewExample : Scenario { public override void Setup () { diff --git a/UICatalog/Scenarios/ListViewWithSelection.cs b/UICatalog/Scenarios/ListViewWithSelection.cs index 9e746cf3c..1f7608acf 100644 --- a/UICatalog/Scenarios/ListViewWithSelection.cs +++ b/UICatalog/Scenarios/ListViewWithSelection.cs @@ -5,10 +5,10 @@ using System.Collections.Generic; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "List View With Selection", Description: "ListView with columns and selection")] [ScenarioCategory ("Controls")] - class ListViewWithSelection : Scenario { + public class ListViewWithSelection : Scenario { public CheckBox _customRenderCB; public CheckBox _allowMarkingCB; diff --git a/UICatalog/Scenarios/ListsAndCombos.cs b/UICatalog/Scenarios/ListsAndCombos.cs index 56fa9c0f2..ed06a6639 100644 --- a/UICatalog/Scenarios/ListsAndCombos.cs +++ b/UICatalog/Scenarios/ListsAndCombos.cs @@ -8,7 +8,7 @@ using NStack; namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "ListView & ComboBox", Description: "Demonstrates a ListView populating a ComboBox that acts as a filter.")] [ScenarioCategory ("Controls")] - class ListsAndCombos : Scenario { + public class ListsAndCombos : Scenario { public override void Setup () { diff --git a/UICatalog/Scenarios/MessageBoxes.cs b/UICatalog/Scenarios/MessageBoxes.cs index d8027e00c..cd16d54c2 100644 --- a/UICatalog/Scenarios/MessageBoxes.cs +++ b/UICatalog/Scenarios/MessageBoxes.cs @@ -4,11 +4,11 @@ using System.Collections.Generic; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "MessageBoxes", Description: "Demonstrates how to use MessageBoxes")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Dialogs")] - class MessageBoxes : Scenario { + public class MessageBoxes : Scenario { public override void Setup () { var frame = new FrameView ("MessageBox Options") { diff --git a/UICatalog/Scenarios/Mouse.cs b/UICatalog/Scenarios/Mouse.cs index 7c4a1457f..9c64def99 100644 --- a/UICatalog/Scenarios/Mouse.cs +++ b/UICatalog/Scenarios/Mouse.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Mouse", Description: "Demonstrates how to capture mouse events")] [ScenarioCategory ("Input")] - class Mouse : Scenario { + public class Mouse : Scenario { public override void Setup () { Label ml; diff --git a/UICatalog/Scenarios/Notepad.cs b/UICatalog/Scenarios/Notepad.cs index ddf5cb78a..963865fac 100644 --- a/UICatalog/Scenarios/Notepad.cs +++ b/UICatalog/Scenarios/Notepad.cs @@ -11,7 +11,7 @@ namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Notepad", Description: "Multi tab text editor")] [ScenarioCategory ("Controls")] - class Notepad : Scenario { + public class Notepad : Scenario { TabView tabView; Label lblStatus; diff --git a/UICatalog/Scenarios/Progress.cs b/UICatalog/Scenarios/Progress.cs index bf4440bf4..0727f07a5 100644 --- a/UICatalog/Scenarios/Progress.cs +++ b/UICatalog/Scenarios/Progress.cs @@ -4,7 +4,7 @@ using System.Threading; using Terminal.Gui; using System.Linq; -namespace UICatalog { +namespace UICatalog.Scenarios { // // This would be a great scenario to show of threading (Issue #471) // @@ -12,7 +12,7 @@ namespace UICatalog { [ScenarioCategory ("Controls")] [ScenarioCategory ("MainLoop")] [ScenarioCategory ("Threading")] - class Progress : Scenario { + public class Progress : Scenario { class ProgressDemo : FrameView { const int _verticalSpace = 1; diff --git a/UICatalog/Scenarios/ProgressBarStyles.cs b/UICatalog/Scenarios/ProgressBarStyles.cs index 91da481ac..a272ba708 100644 --- a/UICatalog/Scenarios/ProgressBarStyles.cs +++ b/UICatalog/Scenarios/ProgressBarStyles.cs @@ -3,11 +3,11 @@ using System.Linq; using System.Threading; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "ProgressBar Styles", Description: "Shows the ProgressBar Styles")] [ScenarioCategory ("Controls")] [ScenarioCategory ("MainLoop")] - class ProgressBarStyles : Scenario { + public class ProgressBarStyles : Scenario { private Timer _fractionTimer; private Timer _pulseTimer; private const uint _timerTick = 100; diff --git a/UICatalog/Scenarios/Scrolling.cs b/UICatalog/Scenarios/Scrolling.cs index f334eed53..b98ffe970 100644 --- a/UICatalog/Scenarios/Scrolling.cs +++ b/UICatalog/Scenarios/Scrolling.cs @@ -1,12 +1,12 @@ using System; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Scrolling", Description: "Demonstrates ScrollView etc...")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Bug Repro")] - class Scrolling : Scenario { + public class Scrolling : Scenario { class Box10x : View { int w = 40; diff --git a/UICatalog/Scenarios/SendKeys.cs b/UICatalog/Scenarios/SendKeys.cs index 60d3775e2..68d9dde71 100644 --- a/UICatalog/Scenarios/SendKeys.cs +++ b/UICatalog/Scenarios/SendKeys.cs @@ -1,10 +1,10 @@ using System; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "SendKeys", Description: "SendKeys sample - Send key combinations.")] [ScenarioCategory ("Input")] - class SendKeys : Scenario { + public class SendKeys : Scenario { public override void Setup () { var label = new Label ("Insert the text to send:") { diff --git a/UICatalog/Scenarios/SingleBackgroundWorker.cs b/UICatalog/Scenarios/SingleBackgroundWorker.cs index 0cb7c262b..80bbafbad 100644 --- a/UICatalog/Scenarios/SingleBackgroundWorker.cs +++ b/UICatalog/Scenarios/SingleBackgroundWorker.cs @@ -4,13 +4,13 @@ using System.ComponentModel; using System.Threading; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Single BackgroundWorker", Description: "A single BackgroundWorker threading opening another Toplevel")] [ScenarioCategory ("Threading")] [ScenarioCategory ("TopLevel")] [ScenarioCategory ("Dialogs")] [ScenarioCategory ("Controls")] - class SingleBackgroundWorker : Scenario { + public class SingleBackgroundWorker : Scenario { public override void Run () { Top.Dispose (); diff --git a/UICatalog/Scenarios/SyntaxHighlighting.cs b/UICatalog/Scenarios/SyntaxHighlighting.cs index 3f43477d4..7ced33d3b 100644 --- a/UICatalog/Scenarios/SyntaxHighlighting.cs +++ b/UICatalog/Scenarios/SyntaxHighlighting.cs @@ -9,7 +9,7 @@ using Attribute = Terminal.Gui.Attribute; namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Syntax Highlighting", Description: "Text editor with keyword highlighting")] [ScenarioCategory ("Controls")] - class SyntaxHighlighting : Scenario { + public class SyntaxHighlighting : Scenario { SqlTextView textView; MenuItem miWrap; diff --git a/UICatalog/Scenarios/SystemConsole.cs b/UICatalog/Scenarios/SystemConsole.cs index 79a83e657..12701f257 100644 --- a/UICatalog/Scenarios/SystemConsole.cs +++ b/UICatalog/Scenarios/SystemConsole.cs @@ -1,10 +1,10 @@ using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "System Console", Description: "Not working - #518 - Enables System Console and exercises things")] [ScenarioCategory ("Bug Repro")] [ScenarioCategory ("Console")] - class UseSystemConsole : Scenario { + public class UseSystemConsole : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { Application.UseSystemConsole = true; diff --git a/UICatalog/Scenarios/TabViewExample.cs b/UICatalog/Scenarios/TabViewExample.cs index 0ed553d57..efe087cab 100644 --- a/UICatalog/Scenarios/TabViewExample.cs +++ b/UICatalog/Scenarios/TabViewExample.cs @@ -11,7 +11,7 @@ namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Tab View", Description: "Demos TabView control with limited screen space in Absolute layout")] [ScenarioCategory ("Controls")] - class TabViewExample : Scenario { + public class TabViewExample : Scenario { TabView tabView; diff --git a/UICatalog/Scenarios/Text.cs b/UICatalog/Scenarios/Text.cs index 7d99e8574..2224f54b5 100644 --- a/UICatalog/Scenarios/Text.cs +++ b/UICatalog/Scenarios/Text.cs @@ -5,11 +5,11 @@ using Terminal.Gui.TextValidateProviders; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Text Input Controls", Description: "Tests all text input controls")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Bug Repro")] - class Text : Scenario { + public class Text : Scenario { public override void Setup () { var s = "TAB to jump between text fields."; diff --git a/UICatalog/Scenarios/TextAlignments.cs b/UICatalog/Scenarios/TextAlignments.cs index 107a12ab5..dc875ab05 100644 --- a/UICatalog/Scenarios/TextAlignments.cs +++ b/UICatalog/Scenarios/TextAlignments.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Text Alignment", Description: "Demonstrates text alignment")] [ScenarioCategory ("Text")] - class TextAlignments : Scenario { + public class TextAlignments : Scenario { public override void Setup () { Win.X = 10; diff --git a/UICatalog/Scenarios/TextAlignmentsAndDirection.cs b/UICatalog/Scenarios/TextAlignmentsAndDirection.cs index e83e17fbe..a0e7a8f9d 100644 --- a/UICatalog/Scenarios/TextAlignmentsAndDirection.cs +++ b/UICatalog/Scenarios/TextAlignmentsAndDirection.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Text Alignment and Direction", Description: "Demonstrates text alignment")] [ScenarioCategory ("Text")] - class TextAlignmentsAndDirections : Scenario { + public class TextAlignmentsAndDirections : Scenario { public override void Setup () { diff --git a/UICatalog/Scenarios/TextFormatterDemo.cs b/UICatalog/Scenarios/TextFormatterDemo.cs index ee76c871a..5622a1278 100644 --- a/UICatalog/Scenarios/TextFormatterDemo.cs +++ b/UICatalog/Scenarios/TextFormatterDemo.cs @@ -6,11 +6,11 @@ using System.Text; using Terminal.Gui; using Rune = System.Rune; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "TextFormatter Demo", Description: "Demos and tests the TextFormatter class.")] [ScenarioCategory ("Text")] [ScenarioCategory ("POC")] - class TextFormatterDemo : Scenario { + public class TextFormatterDemo : Scenario { public override void Setup () { // TODO: Move this to another Scenario that specifically tests `Views` that have no subviews. diff --git a/UICatalog/Scenarios/Threading.cs b/UICatalog/Scenarios/Threading.cs index 933d3a0cf..99ff09b10 100644 --- a/UICatalog/Scenarios/Threading.cs +++ b/UICatalog/Scenarios/Threading.cs @@ -4,10 +4,10 @@ using System.Threading; using System.Threading.Tasks; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Threading", Description: "Demonstration of how to use threading in different ways")] [ScenarioCategory ("Threading")] - class Threading : Scenario { + public class Threading : Scenario { private Action _action; private Action _lambda; private EventHandler _handler; diff --git a/UICatalog/Scenarios/TimeAndDate.cs b/UICatalog/Scenarios/TimeAndDate.cs index ba657a045..89ba77975 100644 --- a/UICatalog/Scenarios/TimeAndDate.cs +++ b/UICatalog/Scenarios/TimeAndDate.cs @@ -1,11 +1,11 @@ using System; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Time And Date", Description: "Illustrates TimeField and time & date handling")] [ScenarioCategory ("Controls")] [ScenarioCategory ("Bug Repro")] // Issue #246 - class TimeAndDate : Scenario { + public class TimeAndDate : Scenario { Label lblOldTime; Label lblNewTime; Label lblTimeFmt; diff --git a/UICatalog/Scenarios/TopLevelNoWindowBug.cs b/UICatalog/Scenarios/TopLevelNoWindowBug.cs index 5d80b3f75..6582b2815 100644 --- a/UICatalog/Scenarios/TopLevelNoWindowBug.cs +++ b/UICatalog/Scenarios/TopLevelNoWindowBug.cs @@ -1,10 +1,10 @@ using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "TopLevelNoWindowBug", Description: "Illustrates that not having a Window causes MenuBar to misbehave. #437")] [ScenarioCategory ("Bug Repro")] - class TopLevelNoWindowBug : Scenario { + public class TopLevelNoWindowBug : Scenario { public override void Run () { diff --git a/UICatalog/Scenarios/TreeUseCases.cs b/UICatalog/Scenarios/TreeUseCases.cs index a2b616d80..11a269507 100644 --- a/UICatalog/Scenarios/TreeUseCases.cs +++ b/UICatalog/Scenarios/TreeUseCases.cs @@ -8,7 +8,7 @@ using Terminal.Gui.Trees; namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Tree View", Description: "Simple tree view examples")] [ScenarioCategory ("Controls")] - class TreeUseCases : Scenario { + public class TreeUseCases : Scenario { View currentTree; diff --git a/UICatalog/Scenarios/TreeViewFileSystem.cs b/UICatalog/Scenarios/TreeViewFileSystem.cs index e6ba59323..1ac497dea 100644 --- a/UICatalog/Scenarios/TreeViewFileSystem.cs +++ b/UICatalog/Scenarios/TreeViewFileSystem.cs @@ -8,7 +8,7 @@ using Terminal.Gui.Trees; namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "TreeViewFileSystem", Description: "Hierarchical file system explorer based on TreeView")] [ScenarioCategory ("Controls")] - class TreeViewFileSystem : Scenario { + public class TreeViewFileSystem : Scenario { /// /// A tree view where nodes are files and folders diff --git a/UICatalog/Scenarios/Unicode.cs b/UICatalog/Scenarios/Unicode.cs index 8da3cb3d2..0fed64890 100644 --- a/UICatalog/Scenarios/Unicode.cs +++ b/UICatalog/Scenarios/Unicode.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Text; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Unicode", Description: "Tries to test Unicode in all controls (#204)")] [ScenarioCategory ("Text")] [ScenarioCategory ("Controls")] - class UnicodeInMenu : Scenario { + public class UnicodeInMenu : Scenario { public override void Setup () { const string IdenticalSign = "\u2261"; diff --git a/UICatalog/Scenarios/WindowsAndFrameViews.cs b/UICatalog/Scenarios/WindowsAndFrameViews.cs index df590328c..22b04b7b7 100644 --- a/UICatalog/Scenarios/WindowsAndFrameViews.cs +++ b/UICatalog/Scenarios/WindowsAndFrameViews.cs @@ -2,12 +2,12 @@ using System.Linq; using Terminal.Gui; -namespace UICatalog { +namespace UICatalog.Scenarios { [ScenarioMetadata (Name: "Windows & FrameViews", Description: "Shows Windows, sub-Windows, FrameViews, and how TAB doesn't work right (#434, #522)")] [ScenarioCategory ("Views")] [ScenarioCategory ("Layout")] [ScenarioCategory ("Bug Repro")] - class WindowsAndFrameViews : Scenario { + public class WindowsAndFrameViews : Scenario { public override void Init (Toplevel top, ColorScheme colorScheme) { Application.Init (); diff --git a/UICatalog/UICatalog.cs b/UICatalog/UICatalog.cs index 6b1133250..3dc1d9f59 100644 --- a/UICatalog/UICatalog.cs +++ b/UICatalog/UICatalog.cs @@ -11,6 +11,9 @@ using System.Text; using Terminal.Gui; using Rune = System.Rune; +/// +/// UI Catalog is a comprehensive sample library for Terminal.Gui. It provides a simple UI for adding to the catalog of scenarios. +/// /// /// /// UI Catalog attempts to satisfy the following goals: @@ -38,7 +41,6 @@ using Rune = System.Rune; /// See the project README for more details (https://github.com/migueldeicaza/gui.cs/tree/master/UICatalog/README.md). /// /// - namespace UICatalog { /// /// UI Catalog is a comprehensive sample app and scenario library for diff --git a/docfx/articles/index.md b/docfx/articles/index.md index d31980fc0..b0d4db75b 100644 --- a/docfx/articles/index.md +++ b/docfx/articles/index.md @@ -1,7 +1,7 @@ # Conceptual Documentation -* [Terminal.Gui Overview](overview.html) -* [Keyboard Event Processing](keyboard.html) +* [Terminal.Gui Overview](overview.md) +* [Keyboard Event Processing](keyboard.md) * [Event Processing and the Application Main Loop](mainloop.md) * [TableView Deep Dive](tableview.md) * [TreeView Deep Dive](treeview.md) diff --git a/docfx/articles/keyboard.md b/docfx/articles/keyboard.md index 7faa4b9e5..2872d1dcd 100644 --- a/docfx/articles/keyboard.md +++ b/docfx/articles/keyboard.md @@ -1,7 +1,7 @@ Keyboard Event Processing ========================= -Keyboard events are sent by the [Main Loop](mainloop.html) to the +Keyboard events are sent by the [Main Loop](mainloop.md) to the Application class for processing. The keyboard events are sent exclusively to the current `Toplevel`, this being either the default that is created when you call `Application.Init`, or one that you diff --git a/docfx/articles/mainloop.md b/docfx/articles/mainloop.md index e019761f0..dd6249994 100644 --- a/docfx/articles/mainloop.md +++ b/docfx/articles/mainloop.md @@ -25,12 +25,12 @@ This class provides the following capabilities: * On Unix systems, it can monitor file descriptors for readability or writability. The `MainLoop` property in the the -[`Application`](../api/Terminal.Gui/Terminal.Gui.Application.html) +[`Application`](/api/Terminal.Gui/Terminal.Gui.Application.html) provides access to these functions. When your code invokes `Application.Run (Toplevel)`, the application will prepare the current -[`Toplevel`](../api/Terminal.Gui/Terminal.Gui.Toplevel.html) instance by +[`Toplevel`](/api/Terminal.Gui/Terminal.Gui.Toplevel.html) instance by redrawing the screen appropriately and then calling the mainloop to run. @@ -39,7 +39,7 @@ can configure the MainLoop in response to events during the execution. The keyboard inputs is dispatched by the application class to the current TopLevel window this is covered in more detail in the -[Keyboard Event Processing](keyboard.html) document. +[Keyboard Event Processing](keyboard.md) document. Async Execution diff --git a/docfx/articles/overview.md b/docfx/articles/overview.md index 8e5780f62..cceb7197a 100644 --- a/docfx/articles/overview.md +++ b/docfx/articles/overview.md @@ -41,10 +41,10 @@ the various views that are included. In the following sections, you will see how applications are put together. In the example above, you can see that we have initialized the runtime by calling the -[`Init`](../api/Terminal.Gui/Terminal.Gui.Application.html#Terminal_Gui_Application_Init) method in the Application class - this sets up the environment, initializes the color +[`Init`](/api/Terminal.Gui/Terminal.Gui.Application.html#Terminal_Gui_Application_Init) method in the Application class - this sets up the environment, initializes the color schemes available for your application and clears the screen to start your application. -The [`Application`](../api/Terminal.Gui/Terminal.Gui.Application.html) class, additionally creates an instance of the [`Toplevel`](../api/Terminal.Gui/Terminal.Gui.Toplevel.html) class that is ready to be consumed, +The [`Application`](/api/Terminal.Gui/Terminal.Gui.Application.html) class, additionally creates an instance of the [`Toplevel`](/api/Terminal.Gui/Terminal.Gui.Toplevel.html) class that is ready to be consumed, this instance is available in the `Application.Top` property, and can be used like this: ```csharp @@ -103,13 +103,13 @@ Views ===== All visible elements on a Terminal.Gui application are implemented as -[Views](../api/Terminal.Gui/Terminal.Gui.View.html). Views are self-contained +[Views](/api/Terminal.Gui/Terminal.Gui.View.html). Views are self-contained objects that take care of displaying themselves, can receive keyboard and mouse input and participate in the focus mechanism. Every view can contain an arbitrary number of children views. These are called the Subviews. You can add a view to an existing view, by calling the -[`Add`](../api/Terminal.Gui/Terminal.Gui.View.html#Terminal_Gui_View_Add_Terminal_Gui_View_) method, for example, to add a couple of buttons to a UI, you can do this: +[`Add`](/api/Terminal.Gui/Terminal.Gui.View.html#Terminal_Gui_View_Add_Terminal_Gui_View_) method, for example, to add a couple of buttons to a UI, you can do this: ```csharp void SetupMyView (View myView) @@ -137,18 +137,18 @@ View. There are many views that you can use to spice up your application: -[Buttons](../api/Terminal.Gui/Terminal.Gui.Button.html), [Labels](../api/Terminal.Gui/Terminal.Gui.Label.html), [Text entry](../api/Terminal.Gui/Terminal.Gui.TextField.html), [Text view](../api/Terminal.Gui/Terminal.Gui.TextView.html), [Radio buttons](../api/Terminal.Gui/Terminal.Gui.RadioGroup.html), [Checkboxes](../api/Terminal.Gui/Terminal.Gui.CheckBox.html), [Dialog boxes](../api/Terminal.Gui/Terminal.Gui.Dialog.html), [Message boxes](../api/Terminal.Gui/Terminal.Gui.MessageBox.html), [Windows](../api/Terminal.Gui/Terminal.Gui.Window.html), [Menus](../api/Terminal.Gui/Terminal.Gui.MenuBar.html), [ListViews](../api/Terminal.Gui/Terminal.Gui.ListView.html), [Frames](../api/Terminal.Gui/Terminal.Gui.FrameView.html), [ProgressBars](../api/Terminal.Gui/Terminal.Gui.ProgressBar.html), [Scroll views](../api/Terminal.Gui/Terminal.Gui.ScrollView.html) and [Scrollbars](../api/Terminal.Gui/Terminal.Gui.ScrollBarView.html). +[Buttons](/api/Terminal.Gui/Terminal.Gui.Button.html), [Labels](/api/Terminal.Gui/Terminal.Gui.Label.html), [Text entry](/api/Terminal.Gui/Terminal.Gui.TextField.html), [Text view](/api/Terminal.Gui/Terminal.Gui.TextView.html), [Radio buttons](/api/Terminal.Gui/Terminal.Gui.RadioGroup.html), [Checkboxes](/api/Terminal.Gui/Terminal.Gui.CheckBox.html), [Dialog boxes](/api/Terminal.Gui/Terminal.Gui.Dialog.html), [Message boxes](/api/Terminal.Gui/Terminal.Gui.MessageBox.html), [Windows](/api/Terminal.Gui/Terminal.Gui.Window.html), [Menus](/api/Terminal.Gui/Terminal.Gui.MenuBar.html), [ListViews](/api/Terminal.Gui/Terminal.Gui.ListView.html), [Frames](/api/Terminal.Gui/Terminal.Gui.FrameView.html), [ProgressBars](/api/Terminal.Gui/Terminal.Gui.ProgressBar.html), [Scroll views](/api/Terminal.Gui/Terminal.Gui.ScrollView.html) and [Scrollbars](/api/Terminal.Gui/Terminal.Gui.ScrollBarView.html). Layout ------ `Terminal.Gui` supports two different layout systems, absolute and computed \ -(controlled by the [`LayoutStyle`](../api/Terminal.Gui/Terminal.Gui.LayoutStyle.html) +(controlled by the [`LayoutStyle`](/api/Terminal.Gui/Terminal.Gui.LayoutStyle.html) property on the view. The absolute system is used when you want the view to be positioned exactly in one location and want to manually control where the view is. This is done -by invoking your View constructor with an argument of type [`Rect`](../api/Terminal.Gui/Terminal.Gui.Rect.html). When you do this, to change the +by invoking your View constructor with an argument of type [`Rect`](/api/Terminal.Gui/Terminal.Gui.Rect.html). When you do this, to change the position of the View, you can change the `Frame` property on the View. The computed layout system offers a few additional capabilities, like automatic @@ -172,7 +172,7 @@ var label = new Label ("Hello") { var label2 = new Label (new Rect (1, 2, 20, 1), "World") ``` -The computed layout system does not take integers, instead the `X` and `Y` properties are of type [`Pos`](../api/Terminal.Gui/Terminal.Gui.Pos.html) and the `Width` and `Height` properties are of type [`Dim`](../api/Terminal.Gui/Terminal.Gui.Dim.html) both which can be created implicitly from integer values. +The computed layout system does not take integers, instead the `X` and `Y` properties are of type [`Pos`](/api/Terminal.Gui/Terminal.Gui.Pos.html) and the `Width` and `Height` properties are of type [`Dim`](/api/Terminal.Gui/Terminal.Gui.Dim.html) both which can be created implicitly from integer values. ### The `Pos` Type @@ -223,8 +223,8 @@ anotherView.Height = Dim.Height (view)+1 # TopLevels, Windows and Dialogs. -Among the many kinds of views, you typically will create a [Toplevel](../api/Terminal.Gui/Terminal.Gui.Toplevel.html) view (or any of its subclasses, -like [Window](../api/Terminal.Gui/Terminal.Gui.Window.html) or [Dialog](../api/Terminal.Gui/Terminal.Gui.Dialog.html) which is special kind of views +Among the many kinds of views, you typically will create a [Toplevel](/api/Terminal.Gui/Terminal.Gui.Toplevel.html) view (or any of its subclasses, +like [Window](/api/Terminal.Gui/Terminal.Gui.Window.html) or [Dialog](/api/Terminal.Gui/Terminal.Gui.Dialog.html) which is special kind of views that can be executed modally - that is, the view can take over all input and returns only when the user chooses to complete their work there. @@ -232,7 +232,7 @@ The following sections cover the differences. ## TopLevel Views -[Toplevel](../api/Terminal.Gui/Terminal.Gui.Toplevel.html) views have no visible user interface elements and occupy an arbitrary portion of the screen. +[Toplevel](/api/Terminal.Gui/Terminal.Gui.Toplevel.html) views have no visible user interface elements and occupy an arbitrary portion of the screen. You would use a toplevel Modal view for example to launch an entire new experience in your application, one where you would have a new top-level menu for example. You typically would add a Menu and a Window to your Toplevel, it would look like this: @@ -284,14 +284,14 @@ class Demo { Window Views ------------ -[Window](../api/Terminal.Gui/Terminal.Gui.Window.html) views extend the Toplevel view by providing a frame and a title around the toplevel - and can be moved on the screen with the mouse (caveat: code is currently disabled) +[Window](/api/Terminal.Gui/Terminal.Gui.Window.html) views extend the Toplevel view by providing a frame and a title around the toplevel - and can be moved on the screen with the mouse (caveat: code is currently disabled) From a user interface perspective, you might have more than one Window on the screen at a given time. Dialogs ------- -[Dialog](../api/Terminal.Gui/Terminal.Gui.Dialog.html) are [Window](../api/Terminal.Gui/Terminal.Gui.Window.html) objects that happen to be centered in the middle of the screen. +[Dialog](/api/Terminal.Gui/Terminal.Gui.Dialog.html) are [Window](/api/Terminal.Gui/Terminal.Gui.Window.html) objects that happen to be centered in the middle of the screen. Dialogs are instances of a Window that are centered in the screen, and are intended to be used modally - that is, they run, and they are expected to return a result @@ -383,7 +383,7 @@ Mouse events are processed in visual order, and the event will be sent to the view on the screen. The only exception is that no mouse events are delivered to background views when a modal view is running. -More details are available on the [`Keyboard Event Processing`](keyboard.html) document. +More details are available on the [`Keyboard Event Processing`](keyboard.md) document. Colors and Color Schemes ======================== @@ -391,9 +391,10 @@ Colors and Color Schemes All views have been configured with a color scheme that will work both in color terminals as well as the more limited black and white terminals. -The various styles are captured in the [`Colors`](../api/Terminal.Gui/Terminal.Gui.Colors.html) class which defined color schemes for -the normal views, the menu bar, popup dialog boxes and error dialog boxes, that you can use like this: +The various styles are captured in the [`Colors`](/api/Terminal.Gui/Terminal.Gui.Colors.html) class which defined color schemes for +the toplevel, the normal views, the menu bar, popup dialog boxes and error dialog boxes, that you can use like this: +* `Colors.Toplevel` * `Colors.Base` * `Colors.Menu` * `Colors.Dialog` @@ -406,7 +407,7 @@ var w = new Window ("Hello"); w.ColorScheme = Colors.Error ``` -The [`ColorScheme`](../api/Terminal.Gui/Terminal.Gui.ColorScheme.html) represents +The [`ColorScheme`](/api/Terminal.Gui/Terminal.Gui.ColorScheme.html) represents four values, the color used for Normal text, the color used for normal text when a view is focused an the colors for the hot-keys both in focused and unfocused modes. @@ -425,4 +426,4 @@ label.TextColor = myColor MainLoop, Threads and Input Handling ==================================== -Detailed description of the mainloop is described on the [Event Processing and the Application Main Loop](mainloop.html) document. +Detailed description of the mainloop is described on the [Event Processing and the Application Main Loop](/articles/mainloop.html) document. diff --git a/docfx/articles/tableview.md b/docfx/articles/tableview.md index 1b6948e80..87feaa8ee 100644 --- a/docfx/articles/tableview.md +++ b/docfx/articles/tableview.md @@ -4,7 +4,7 @@ This control supports viewing and editing tabular data. It provides a view of a System.DataTable is a core class of .net standard and can be created very easily -[TableView API Reference](api/Terminal.Gui/Terminal.Gui.TableView.html) +[TableView API Reference](/api/Terminal.Gui/Terminal.Gui.TableView.html) ## Csv Example diff --git a/docfx/articles/treeview.md b/docfx/articles/treeview.md index 380bf71e3..427a536c0 100644 --- a/docfx/articles/treeview.md +++ b/docfx/articles/treeview.md @@ -2,7 +2,7 @@ TreeView is a control for navigating hierarchical objects. It comes in two forms `TreeView` and `TreeView`. -[TreeView API Reference](api/Terminal.Gui/Terminal.Gui.TreeView.html) +[TreeView API Reference](/api/Terminal.Gui/Terminal.Gui.TreeView.html) ## Using TreeView diff --git a/docfx/docfx.json b/docfx/docfx.json index 4e35d5cf4..bb71ab7e9 100644 --- a/docfx/docfx.json +++ b/docfx/docfx.json @@ -37,7 +37,7 @@ "dest": "api/UICatalog", "shouldSkipMarkup": false, "properties": { - "TargetFramework": "netstandard2.1" + "TargetFramework": "net5.0" } } ], @@ -65,7 +65,7 @@ "resource": [ { "files": [ - "images/**", + "images/**" ], "exclude": [ "obj/**", @@ -87,7 +87,8 @@ "dest": "../docs", "globalMetadata": { "_enableSearch": "true", - "_appLogoPath": "images/logo48.png" + "_appLogoPath": "images/logo48.png", + "_disableContribution": true }, "globalMetadataFiles": [], "fileMetadataFiles": [], diff --git a/docfx/index.md b/docfx/index.md index 784c0e6ef..8aa2d9831 100644 --- a/docfx/index.md +++ b/docfx/index.md @@ -6,9 +6,9 @@ A simple UI toolkit for .NET, .NET Core, and Mono that works on Windows, the Mac ## Terminal.Gui API Documentation -* [API Reference](api/Terminal.Gui/Terminal.Gui.html) -* [Terminal.Gui API Overview](articles/overview.html) -* [Keyboard Event Processing](articles/keyboard.html) +* [API Reference](/api/Terminal.Gui/Terminal.Gui.html) +* [Terminal.Gui API Overview](/articles/overview.html) +* [Keyboard Event Processing](/articles/keyboard.html) * [Event Processing and the Application Main Loop](articles/mainloop.md) * [TableView Deep Dive](articles/tableview.md) * [TreeView Deep Dive](articles/treeview.md) @@ -17,5 +17,5 @@ A simple UI toolkit for .NET, .NET Core, and Mono that works on Windows, the Mac UI Catalog is a comprehensive sample library for Terminal.Gui. It provides a simple UI for adding to the catalog of scenarios. -* [UI Catalog API Reference](api/UICatalog/UICatalog.html) +* [UI Catalog API Reference](/api/UICatalog/UICatalog.html) * [UI Catalog Source](https://github.com/migueldeicaza/gui.cs/tree/master/UICatalog) diff --git a/docfx/runbuild.cmd b/docfx/runbuild.cmd new file mode 100644 index 000000000..6505ce65a --- /dev/null +++ b/docfx/runbuild.cmd @@ -0,0 +1 @@ +powershell.exe -executionpolicy bypass -file .\build.ps1 \ No newline at end of file diff --git a/docs/README.html b/docs/README.html index ae102f953..58a44f754 100644 --- a/docs/README.html +++ b/docs/README.html @@ -8,7 +8,7 @@ To Generate the Docs - + @@ -86,10 +86,6 @@