diff --git a/Terminal.Gui/View/ViewText.cs b/Terminal.Gui/View/ViewText.cs
index 1ac70bb55..63ad748c7 100644
--- a/Terminal.Gui/View/ViewText.cs
+++ b/Terminal.Gui/View/ViewText.cs
@@ -209,46 +209,4 @@ public partial class View
SetTextFormatterSize ();
SetNeedsDisplay ();
}
-
-
- #region AutoSize
-
- [ObsoleteAttribute ("Use Dim.Auto instead.", false)]
- public virtual bool AutoSize
- {
- get => _height is Dim.DimAuto && _width is Dim.DimAuto;
- set
- {
- TextFormatter.AutoSize = value;
-
- // BUGBUG: This is all a hack until AutoSize is removed
- if (value)
- {
- UpdateTextFormatterText ();
-
- if (IsInitialized)
- {
- Height = Dim.Auto (Dim.DimAutoStyle.Text);
- Width = Dim.Auto (Dim.DimAutoStyle.Text);
- }
- else
- {
- _height = Dim.Auto (Dim.DimAutoStyle.Text);
- _width = Dim.Auto (Dim.DimAutoStyle.Text);
- OnResizeNeeded ();
- }
- }
- else
- {
- _height = ContentSize.GetValueOrDefault ().Height;
- _width = ContentSize.GetValueOrDefault ().Width;
-
- // Force ContentSize to be reset to Viewport
- _contentSize = null;
- OnResizeNeeded ();
- }
- }
- }
-
- #endregion AutoSize
}
diff --git a/UICatalog/Scenarios/Adornments.cs b/UICatalog/Scenarios/Adornments.cs
index 5f155b8ee..8467ab784 100644
--- a/UICatalog/Scenarios/Adornments.cs
+++ b/UICatalog/Scenarios/Adornments.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Linq;
using Terminal.Gui;
@@ -21,7 +20,7 @@ public class Adornments : Scenario
Window app = new ()
{
- Title = $"{Application.QuitKey} to Quit - Scenario: {GetName ()}",
+ Title = $"{Application.QuitKey} to Quit - Scenario: {GetName ()}"
};
var editor = new AdornmentsEditor ();
@@ -31,9 +30,9 @@ public class Adornments : Scenario
{
Title = "The _Window",
Arrangement = ViewArrangement.Movable,
- X = Pos.Right(editor),
+ X = Pos.Right (editor),
Width = Dim.Percent (60),
- Height = Dim.Percent (80),
+ Height = Dim.Percent (80)
};
app.Add (window);
@@ -74,7 +73,7 @@ public class Adornments : Scenario
{
Y = Pos.AnchorEnd (),
Width = 40,
- Height = Dim.Percent(20),
+ Height = Dim.Percent (20),
Text = "Label\nY=AnchorEnd(),Height=Dim.Percent(10)",
ColorScheme = Colors.ColorSchemes ["Error"]
};
@@ -88,10 +87,9 @@ public class Adornments : Scenario
window.Padding.Data = "Padding";
window.Padding.Thickness = new (3);
- var longLabel = new Label ()
+ var longLabel = new Label
{
- X = 40, Y = 5, Title = "This is long text (in a label) that should clip.",
-
+ X = 40, Y = 5, Title = "This is long text (in a label) that should clip."
};
longLabel.TextFormatter.WordWrap = true;
window.Add (tf1, color, button, label, btnButtonInWindow, labelAnchorEnd, longLabel);
@@ -99,19 +97,20 @@ public class Adornments : Scenario
editor.Initialized += (s, e) => { editor.ViewToEdit = window; };
window.Initialized += (s, e) =>
- {
- var labelInPadding = new Label () { X = 1, Y = 0, Title = "_Text:" };
- window.Padding.Add (labelInPadding);
+ {
+ var labelInPadding = new Label { X = 1, Y = 0, Title = "_Text:" };
+ window.Padding.Add (labelInPadding);
- var textFieldInPadding = new TextField () { X = Pos.Right (labelInPadding) + 1, Y = Pos.Top (labelInPadding), Width = 15, Text = "some text" };
- textFieldInPadding.Accept += (s, e) => MessageBox.Query (20, 7, "TextField", textFieldInPadding.Text, "Ok");
- window.Padding.Add (textFieldInPadding);
+ var textFieldInPadding = new TextField
+ { X = Pos.Right (labelInPadding) + 1, Y = Pos.Top (labelInPadding), Width = 15, Text = "some text" };
+ textFieldInPadding.Accept += (s, e) => MessageBox.Query (20, 7, "TextField", textFieldInPadding.Text, "Ok");
+ window.Padding.Add (textFieldInPadding);
- var btnButtonInPadding = new Button { X = Pos.Center (), Y = 0, Text = "_Button in Padding" };
- btnButtonInPadding.Accept += (s, e) => MessageBox.Query (20, 7, "Hi", "Button in Padding Pressed!", "Ok");
- btnButtonInPadding.BorderStyle = LineStyle.Dashed;
- btnButtonInPadding.Border.Thickness = new (1, 1, 1, 1);
- window.Padding.Add (btnButtonInPadding);
+ var btnButtonInPadding = new Button { X = Pos.Center (), Y = 0, Text = "_Button in Padding" };
+ btnButtonInPadding.Accept += (s, e) => MessageBox.Query (20, 7, "Hi", "Button in Padding Pressed!", "Ok");
+ btnButtonInPadding.BorderStyle = LineStyle.Dashed;
+ btnButtonInPadding.Border.Thickness = new (1, 1, 1, 1);
+ window.Padding.Add (btnButtonInPadding);
#if SUBVIEW_BASED_BORDER
btnButtonInPadding.Border.CloseButton.Visible = true;
@@ -125,7 +124,7 @@ public class Adornments : Scenario
view.Accept += (s, e) => MessageBox.Query (20, 7, "Hi", "Window Close Button Pressed!", "Ok");
#endif
- };
+ };
app.Closed += (s, e) => View.Diagnostics = _diagnosticFlags;
@@ -136,7 +135,7 @@ public class Adornments : Scenario
}
///
- /// Provides a composable UI for editing the settings of an Adornment.
+ /// Provides a composable UI for editing the settings of an Adornment.
///
public class AdornmentEditor : View
{
@@ -171,6 +170,7 @@ public class Adornments : Scenario
BorderStyle = LineStyle.Double;
Initialized += AdornmentEditor_Initialized;
}
+
public Attribute Color
{
get => new (_foregroundColorPicker.SelectedColor, _backgroundColorPicker.SelectedColor);
@@ -337,7 +337,7 @@ public class Adornments : Scenario
}
///
- /// Provides an editor UI for the Margin, Border, and Padding of a View.
+ /// Provides an editor UI for the Margin, Border, and Padding of a View.
///
public class AdornmentsEditor : View
{
@@ -470,19 +470,19 @@ public class Adornments : Scenario
_paddingEditor.AttributeChanged += Editor_AttributeChanged;
Add (_paddingEditor);
- _diagCheckBox = new CheckBox { Text = "_Diagnostics", Y = Pos.Bottom (_paddingEditor) };
- _diagCheckBox.Checked = View.Diagnostics != ViewDiagnosticFlags.Off;
+ _diagCheckBox = new() { Text = "_Diagnostics", Y = Pos.Bottom (_paddingEditor) };
+ _diagCheckBox.Checked = Diagnostics != ViewDiagnosticFlags.Off;
_diagCheckBox.Toggled += (s, e) =>
{
if (e.NewValue == true)
{
- View.Diagnostics =
+ Diagnostics =
ViewDiagnosticFlags.Padding | ViewDiagnosticFlags.Ruler;
}
else
{
- View.Diagnostics = ViewDiagnosticFlags.Off;
+ Diagnostics = ViewDiagnosticFlags.Off;
}
};
diff --git a/UICatalog/Scenarios/Dialogs.cs b/UICatalog/Scenarios/Dialogs.cs
index 869d71226..cdc05fe10 100644
--- a/UICatalog/Scenarios/Dialogs.cs
+++ b/UICatalog/Scenarios/Dialogs.cs
@@ -42,7 +42,7 @@ public class Dialogs : Scenario
};
frame.Add (widthEdit);
- label = new Label
+ label = new()
{
X = 0,
Y = Pos.Bottom (label),
@@ -76,9 +76,8 @@ public class Dialogs : Scenario
}
);
- label = new Label
+ label = new()
{
- AutoSize = false,
X = 0,
Y = Pos.Bottom (label),
Width = Dim.Width (numButtonsLabel),
@@ -121,9 +120,8 @@ public class Dialogs : Scenario
};
frame.Add (glyphsNotWords);
- label = new Label
+ label = new()
{
- AutoSize = false,
X = 0,
Y = Pos.Bottom (glyphsNotWords),
Width = Dim.Width (numButtonsLabel),
@@ -132,6 +130,7 @@ public class Dialogs : Scenario
Text = "Button St_yle:"
};
frame.Add (label);
+
var styleRadioGroup = new RadioGroup
{
X = Pos.Right (label) + 1,
@@ -158,7 +157,7 @@ public class Dialogs : Scenario
Win.Add (frame);
- label = new Label
+ label = new()
{
X = Pos.Center (), Y = Pos.Bottom (frame) + 4, TextAlignment = TextAlignment.Right, Text = "Button Pressed:"
};
@@ -180,19 +179,19 @@ public class Dialogs : Scenario
};
showDialogButton.Accept += (s, e) =>
- {
- Dialog dlg = CreateDemoDialog (
- widthEdit,
- heightEdit,
- titleEdit,
- numButtonsEdit,
- glyphsNotWords,
- styleRadioGroup,
- buttonPressedLabel
- );
- Application.Run (dlg);
- dlg.Dispose ();
- };
+ {
+ Dialog dlg = CreateDemoDialog (
+ widthEdit,
+ heightEdit,
+ titleEdit,
+ numButtonsEdit,
+ glyphsNotWords,
+ styleRadioGroup,
+ buttonPressedLabel
+ );
+ Application.Run (dlg);
+ dlg.Dispose ();
+ };
Win.Add (showDialogButton);
@@ -232,7 +231,7 @@ public class Dialogs : Scenario
{
buttonId = i;
- button = new Button
+ button = new()
{
Text = NumberToWords.Convert (buttonId) + " " + char.ConvertFromUtf32 (buttonId + CODE_POINT),
IsDefault = buttonId == 0
@@ -240,14 +239,14 @@ public class Dialogs : Scenario
}
else
{
- button = new Button { Text = NumberToWords.Convert (buttonId), IsDefault = buttonId == 0 };
+ button = new() { Text = NumberToWords.Convert (buttonId), IsDefault = buttonId == 0 };
}
button.Accept += (s, e) =>
- {
- clicked = buttonId;
- Application.RequestStop ();
- };
+ {
+ clicked = buttonId;
+ Application.RequestStop ();
+ };
buttons.Add (button);
}
@@ -261,7 +260,7 @@ public class Dialogs : Scenario
// This tests dynamically adding buttons; ensuring the dialog resizes if needed and
// the buttons are laid out correctly
- dialog = new Dialog
+ dialog = new()
{
Title = titleEdit.Text,
ButtonAlignment = (Dialog.ButtonAlignments)styleRadioGroup.SelectedItem,
@@ -277,36 +276,36 @@ public class Dialogs : Scenario
var add = new Button { X = Pos.Center (), Y = Pos.Center (), Text = "_Add a button" };
add.Accept += (s, e) =>
- {
- int buttonId = buttons.Count;
- Button button;
+ {
+ int buttonId = buttons.Count;
+ Button button;
- if (glyphsNotWords.Checked == true)
- {
- button = new Button
- {
- Text = NumberToWords.Convert (buttonId) + " " + char.ConvertFromUtf32 (buttonId + CODE_POINT),
- IsDefault = buttonId == 0
- };
- }
- else
- {
- button = new Button { Text = NumberToWords.Convert (buttonId), IsDefault = buttonId == 0 };
- }
+ if (glyphsNotWords.Checked == true)
+ {
+ button = new()
+ {
+ Text = NumberToWords.Convert (buttonId) + " " + char.ConvertFromUtf32 (buttonId + CODE_POINT),
+ IsDefault = buttonId == 0
+ };
+ }
+ else
+ {
+ button = new() { Text = NumberToWords.Convert (buttonId), IsDefault = buttonId == 0 };
+ }
- button.Accept += (s, e) =>
- {
- clicked = buttonId;
- Application.RequestStop ();
- };
- buttons.Add (button);
- dialog.AddButton (button);
+ button.Accept += (s, e) =>
+ {
+ clicked = buttonId;
+ Application.RequestStop ();
+ };
+ buttons.Add (button);
+ dialog.AddButton (button);
- if (buttons.Count > 1)
- {
- button.TabIndex = buttons [buttons.Count - 2].TabIndex + 1;
- }
- };
+ if (buttons.Count > 1)
+ {
+ button.TabIndex = buttons [buttons.Count - 2].TabIndex + 1;
+ }
+ };
dialog.Add (add);
var addChar = new Button
@@ -317,14 +316,14 @@ public class Dialogs : Scenario
};
addChar.Accept += (s, e) =>
- {
- foreach (Button button in buttons)
- {
- button.Text += char.ConvertFromUtf32 (CODE_POINT);
- }
+ {
+ foreach (Button button in buttons)
+ {
+ button.Text += char.ConvertFromUtf32 (CODE_POINT);
+ }
- dialog.LayoutSubviews ();
- };
+ dialog.LayoutSubviews ();
+ };
dialog.Closed += (s, e) => { buttonPressedLabel.Text = $"{clicked}"; };
dialog.Add (addChar);
}
diff --git a/UICatalog/Scenarios/DimAutoDemo.cs b/UICatalog/Scenarios/DimAutoDemo.cs
index 4b8317d6d..c42cff51f 100644
--- a/UICatalog/Scenarios/DimAutoDemo.cs
+++ b/UICatalog/Scenarios/DimAutoDemo.cs
@@ -11,6 +11,7 @@ public class DimAutoDemo : Scenario
public override void Main ()
{
Application.Init ();
+
// Setup - Create a top-level application window and configure it.
Window appWindow = new ()
{
@@ -111,7 +112,7 @@ public class DimAutoDemo : Scenario
{
Text = "_Move down",
X = Pos.Right (vlabel),
- Y = Pos.Bottom (vlabel),
+ Y = Pos.Bottom (vlabel)
};
movingButton.Accept += (s, e) => { movingButton.Y = movingButton.Frame.Y + 1; };
view.Add (movingButton);
@@ -142,7 +143,6 @@ public class DimAutoDemo : Scenario
// Shutdown - Calling Application.Shutdown is required.
Application.Shutdown ();
-
}
private void DlgButton_Clicked (object sender, EventArgs e)
@@ -150,7 +150,8 @@ public class DimAutoDemo : Scenario
var dlg = new Dialog
{
Title = "Test Dialog",
- Width = Dim.Auto (min: Dim.Percent (10)),
+ Width = Auto (min: Percent (10))
+
//Height = Dim.Auto (min: Dim.Percent (50))
};
@@ -166,7 +167,7 @@ public class DimAutoDemo : Scenario
//{
// ValidatePosDim = true,
// Text = "This is a label (AutoSize = false; Dim.Auto(3/20). Press Esc to close. Even more text.",
- // AutoSize = false,
+ //
// X = Pos.Center (),
// Y = 0,
// Height = Auto (min: 3),
@@ -178,7 +179,7 @@ public class DimAutoDemo : Scenario
{
ValidatePosDim = true,
Text = "TextField: X=1; Y=Pos.Bottom (label)+1, Width=Dim.Fill (0); Height=1",
- TextFormatter = new TextFormatter { WordWrap = true },
+ TextFormatter = new() { WordWrap = true },
X = 0,
Y = 0, //Pos.Bottom (label) + 1,
Width = Fill (10),
@@ -194,6 +195,7 @@ public class DimAutoDemo : Scenario
//btn.X = Pos.AnchorEnd () - (Pos.Right (btn) - Pos.Left (btn));
//dlg.Add (label);
dlg.Add (text);
+
//dlg.Add (btn);
Application.Run (dlg);
dlg.Dispose ();
diff --git a/UICatalog/Scenarios/DynamicMenuBar.cs b/UICatalog/Scenarios/DynamicMenuBar.cs
index 650e854db..da0768f4f 100644
--- a/UICatalog/Scenarios/DynamicMenuBar.cs
+++ b/UICatalog/Scenarios/DynamicMenuBar.cs
@@ -107,31 +107,31 @@ public class DynamicMenuBar : Scenario
var _lblTitle = new Label { Y = 1, Text = "Title:" };
Add (_lblTitle);
- TextTitle = new TextField { X = Pos.Right (_lblTitle) + 2, Y = Pos.Top (_lblTitle), Width = Dim.Fill () };
+ TextTitle = new() { X = Pos.Right (_lblTitle) + 2, Y = Pos.Top (_lblTitle), Width = Dim.Fill () };
Add (TextTitle);
var _lblHelp = new Label { X = Pos.Left (_lblTitle), Y = Pos.Bottom (_lblTitle) + 1, Text = "Help:" };
Add (_lblHelp);
- TextHelp = new TextField { X = Pos.Left (TextTitle), Y = Pos.Top (_lblHelp), Width = Dim.Fill () };
+ TextHelp = new() { X = Pos.Left (TextTitle), Y = Pos.Top (_lblHelp), Width = Dim.Fill () };
Add (TextHelp);
var _lblAction = new Label { X = Pos.Left (_lblTitle), Y = Pos.Bottom (_lblHelp) + 1, Text = "Action:" };
Add (_lblAction);
- TextAction = new TextView
+ TextAction = new()
{
X = Pos.Left (TextTitle), Y = Pos.Top (_lblAction), Width = Dim.Fill (), Height = 5
};
Add (TextAction);
- CkbIsTopLevel = new CheckBox
+ CkbIsTopLevel = new()
{
X = Pos.Left (_lblTitle), Y = Pos.Bottom (_lblAction) + 5, Text = "IsTopLevel"
};
Add (CkbIsTopLevel);
- CkbSubMenu = new CheckBox
+ CkbSubMenu = new()
{
X = Pos.Left (_lblTitle),
Y = Pos.Bottom (CkbIsTopLevel),
@@ -140,7 +140,7 @@ public class DynamicMenuBar : Scenario
};
Add (CkbSubMenu);
- CkbNullCheck = new CheckBox
+ CkbNullCheck = new()
{
X = Pos.Left (_lblTitle), Y = Pos.Bottom (CkbSubMenu), Text = "Allow null checked"
};
@@ -148,7 +148,7 @@ public class DynamicMenuBar : Scenario
var _rChkLabels = new [] { "NoCheck", "Checked", "Radio" };
- RbChkStyle = new RadioGroup
+ RbChkStyle = new()
{
X = Pos.Left (_lblTitle), Y = Pos.Bottom (CkbSubMenu) + 1, RadioLabels = _rChkLabels
};
@@ -160,7 +160,7 @@ public class DynamicMenuBar : Scenario
};
Add (_lblShortcut);
- TextShortcut = new TextField
+ TextShortcut = new()
{
X = Pos.X (_lblShortcut), Y = Pos.Bottom (_lblShortcut), Width = Dim.Fill (), ReadOnly = true
};
@@ -194,7 +194,7 @@ public class DynamicMenuBar : Scenario
bool CheckShortcut (KeyCode k, bool pre)
{
- MenuItem m = _menuItem != null ? _menuItem : new MenuItem ();
+ MenuItem m = _menuItem != null ? _menuItem : new ();
if (pre && !ShortcutHelper.PreShortcutValidation (k))
{
@@ -422,24 +422,24 @@ public class DynamicMenuBar : Scenario
var btnOk = new Button { IsDefault = true, Text = "Ok" };
btnOk.Accept += (s, e) =>
- {
- if (string.IsNullOrEmpty (TextTitle.Text))
- {
- MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
- }
- else
- {
- valid = true;
- Application.RequestStop ();
- }
- };
+ {
+ if (string.IsNullOrEmpty (TextTitle.Text))
+ {
+ MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
+ }
+ else
+ {
+ valid = true;
+ Application.RequestStop ();
+ }
+ };
var btnCancel = new Button { Text = "Cancel" };
btnCancel.Accept += (s, e) =>
- {
- TextTitle.Text = string.Empty;
- Application.RequestStop ();
- };
+ {
+ TextTitle.Text = string.Empty;
+ Application.RequestStop ();
+ };
var dialog = new Dialog { Title = "Enter the menu details.", Buttons = [btnOk, btnCancel] };
Width = Dim.Fill ();
@@ -452,7 +452,7 @@ public class DynamicMenuBar : Scenario
if (valid)
{
- return new DynamicMenuItem
+ return new()
{
Title = TextTitle.Text,
Help = TextHelp.Text,
@@ -486,13 +486,13 @@ public class DynamicMenuBar : Scenario
}
else
{
- menuItem = new MenuItem (
- menuItem.Title,
- menuItem.Help,
- CreateAction (menuItem, new DynamicMenuItem ()),
- null,
- menuItem.Parent
- );
+ menuItem = new (
+ menuItem.Title,
+ menuItem.Help,
+ CreateAction (menuItem, new ()),
+ null,
+ menuItem.Parent
+ );
if (idx > -1)
{
@@ -569,7 +569,7 @@ public class DynamicMenuBar : Scenario
public DynamicMenuBarSample ()
{
- DataContext = new DynamicMenuItemModel ();
+ DataContext = new ();
var _frmDelimiter = new FrameView
{
@@ -626,7 +626,7 @@ public class DynamicMenuBar : Scenario
TextAlignment = TextAlignment.Centered,
X = Pos.Right (_btnPrevious) + 1,
Y = Pos.Top (_btnPrevious),
- AutoSize = false,
+
Width = Dim.Fill () - Dim.Function (() => _btnAdd.Frame.Width + 1),
Height = 1
};
@@ -639,7 +639,7 @@ public class DynamicMenuBar : Scenario
TextAlignment = TextAlignment.Centered,
X = Pos.Right (_btnPrevious) + 1,
Y = Pos.Top (_btnPrevious) + 1,
- AutoSize = false,
+
Width = Dim.Fill () - Dim.Width (_btnAdd) - 1
};
_frmMenu.Add (_lblParent);
@@ -650,7 +650,7 @@ public class DynamicMenuBar : Scenario
};
_frmMenu.Add (_btnPreviowsParent);
- _lstMenus = new ListView
+ _lstMenus = new()
{
ColorScheme = Colors.ColorSchemes ["Dialog"],
X = Pos.Right (_btnPrevious) + 1,
@@ -688,121 +688,121 @@ public class DynamicMenuBar : Scenario
Add (_frmMenuDetails);
_btnMenuBarUp.Accept += (s, e) =>
- {
- int i = _currentSelectedMenuBar;
+ {
+ int i = _currentSelectedMenuBar;
- MenuBarItem menuItem = _menuBar != null && _menuBar.Menus.Length > 0
- ? _menuBar.Menus [i]
- : null;
+ MenuBarItem menuItem = _menuBar != null && _menuBar.Menus.Length > 0
+ ? _menuBar.Menus [i]
+ : null;
- if (menuItem != null)
- {
- MenuBarItem [] menus = _menuBar.Menus;
+ if (menuItem != null)
+ {
+ MenuBarItem [] menus = _menuBar.Menus;
- if (i > 0)
- {
- menus [i] = menus [i - 1];
- menus [i - 1] = menuItem;
- _currentSelectedMenuBar = i - 1;
- _menuBar.SetNeedsDisplay ();
- }
- }
- };
+ if (i > 0)
+ {
+ menus [i] = menus [i - 1];
+ menus [i - 1] = menuItem;
+ _currentSelectedMenuBar = i - 1;
+ _menuBar.SetNeedsDisplay ();
+ }
+ }
+ };
_btnMenuBarDown.Accept += (s, e) =>
- {
- int i = _currentSelectedMenuBar;
+ {
+ int i = _currentSelectedMenuBar;
- MenuBarItem menuItem = _menuBar != null && _menuBar.Menus.Length > 0
- ? _menuBar.Menus [i]
- : null;
+ MenuBarItem menuItem = _menuBar != null && _menuBar.Menus.Length > 0
+ ? _menuBar.Menus [i]
+ : null;
- if (menuItem != null)
- {
- MenuBarItem [] menus = _menuBar.Menus;
+ if (menuItem != null)
+ {
+ MenuBarItem [] menus = _menuBar.Menus;
- if (i < menus.Length - 1)
- {
- menus [i] = menus [i + 1];
- menus [i + 1] = menuItem;
- _currentSelectedMenuBar = i + 1;
- _menuBar.SetNeedsDisplay ();
- }
- }
- };
+ if (i < menus.Length - 1)
+ {
+ menus [i] = menus [i + 1];
+ menus [i + 1] = menuItem;
+ _currentSelectedMenuBar = i + 1;
+ _menuBar.SetNeedsDisplay ();
+ }
+ }
+ };
_btnUp.Accept += (s, e) =>
- {
- int i = _lstMenus.SelectedItem;
- MenuItem menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null;
+ {
+ int i = _lstMenus.SelectedItem;
+ MenuItem menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null;
- if (menuItem != null)
- {
- MenuItem [] childrens = ((MenuBarItem)_currentMenuBarItem).Children;
+ if (menuItem != null)
+ {
+ MenuItem [] childrens = ((MenuBarItem)_currentMenuBarItem).Children;
- if (i > 0)
- {
- childrens [i] = childrens [i - 1];
- childrens [i - 1] = menuItem;
- DataContext.Menus [i] = DataContext.Menus [i - 1];
+ 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 { Title = menuItem.Title, MenuItem = menuItem };
- _lstMenus.SelectedItem = i - 1;
- }
- }
- };
+ DataContext.Menus [i - 1] =
+ new() { Title = menuItem.Title, MenuItem = menuItem };
+ _lstMenus.SelectedItem = i - 1;
+ }
+ }
+ };
_btnDown.Accept += (s, e) =>
- {
- int i = _lstMenus.SelectedItem;
- MenuItem menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null;
+ {
+ int i = _lstMenus.SelectedItem;
+ MenuItem menuItem = DataContext.Menus.Count > 0 ? DataContext.Menus [i].MenuItem : null;
- if (menuItem != null)
- {
- MenuItem [] childrens = ((MenuBarItem)_currentMenuBarItem).Children;
+ if (menuItem != null)
+ {
+ MenuItem [] 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];
+ 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 { Title = menuItem.Title, MenuItem = menuItem };
- _lstMenus.SelectedItem = i + 1;
- }
- }
- };
+ DataContext.Menus [i + 1] =
+ new() { Title = menuItem.Title, MenuItem = menuItem };
+ _lstMenus.SelectedItem = i + 1;
+ }
+ }
+ };
_btnPreviowsParent.Accept += (s, e) =>
- {
- if (_currentMenuBarItem != null && _currentMenuBarItem.Parent != null)
- {
- MenuItem mi = _currentMenuBarItem;
- _currentMenuBarItem = _currentMenuBarItem.Parent as MenuBarItem;
- SetListViewSource (_currentMenuBarItem, true);
- int i = ((MenuBarItem)_currentMenuBarItem).GetChildrenIndex (mi);
+ {
+ if (_currentMenuBarItem != null && _currentMenuBarItem.Parent != null)
+ {
+ MenuItem mi = _currentMenuBarItem;
+ _currentMenuBarItem = _currentMenuBarItem.Parent as MenuBarItem;
+ SetListViewSource (_currentMenuBarItem, true);
+ int i = ((MenuBarItem)_currentMenuBarItem).GetChildrenIndex (mi);
- if (i > -1)
- {
- _lstMenus.SelectedItem = i;
- }
+ if (i > -1)
+ {
+ _lstMenus.SelectedItem = i;
+ }
- if (_currentMenuBarItem.Parent != null)
- {
- DataContext.Parent = _currentMenuBarItem.Title;
- }
- else
- {
- DataContext.Parent = string.Empty;
- }
- }
- else
- {
- DataContext.Parent = string.Empty;
- }
- };
+ if (_currentMenuBarItem.Parent != null)
+ {
+ DataContext.Parent = _currentMenuBarItem.Title;
+ }
+ else
+ {
+ DataContext.Parent = string.Empty;
+ }
+ }
+ else
+ {
+ DataContext.Parent = string.Empty;
+ }
+ };
var _btnOk = new Button { X = Pos.Right (_frmMenu) + 20, Y = Pos.Bottom (_frmMenuDetails), Text = "Ok" };
Add (_btnOk);
@@ -814,157 +814,157 @@ public class DynamicMenuBar : Scenario
_lstMenus.SelectedItemChanged += (s, e) => { SetFrameDetails (); };
_btnOk.Accept += (s, e) =>
+ {
+ if (string.IsNullOrEmpty (_frmMenuDetails.TextTitle.Text) && _currentEditMenuBarItem != null)
+ {
+ MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
+ }
+ else if (_currentEditMenuBarItem != null)
+ {
+ var menuItem = new DynamicMenuItem
+ {
+ Title = _frmMenuDetails.TextTitle.Text,
+ Help = _frmMenuDetails.TextHelp.Text,
+ Action = _frmMenuDetails.TextAction.Text,
+ IsTopLevel = _frmMenuDetails.CkbIsTopLevel?.Checked ?? false,
+ HasSubMenu = _frmMenuDetails.CkbSubMenu?.Checked ?? false,
+ CheckStyle = _frmMenuDetails.RbChkStyle.SelectedItem == 0
+ ? MenuItemCheckStyle.NoCheck
+ : _frmMenuDetails.RbChkStyle.SelectedItem == 1
+ ? MenuItemCheckStyle.Checked
+ : MenuItemCheckStyle.Radio,
+ Shortcut = _frmMenuDetails.TextShortcut.Text
+ };
+ UpdateMenuItem (_currentEditMenuBarItem, menuItem, _lstMenus.SelectedItem);
+ }
+ };
+
+ _btnAdd.Accept += (s, e) =>
{
- if (string.IsNullOrEmpty (_frmMenuDetails.TextTitle.Text) && _currentEditMenuBarItem != null)
+ if (MenuBar == null)
{
- MessageBox.ErrorQuery ("Invalid title", "Must enter a valid title!.", "Ok");
+ MessageBox.ErrorQuery ("Menu Bar Error", "Must add a MenuBar first!", "Ok");
+ _btnAddMenuBar.SetFocus ();
+
+ return;
}
- else if (_currentEditMenuBarItem != null)
+
+ var frameDetails = new DynamicMenuBarDetails (null, _currentMenuBarItem != null);
+ DynamicMenuItem item = frameDetails.EnterMenuItem ();
+
+ if (item == null)
{
- var menuItem = new DynamicMenuItem
+ return;
+ }
+
+ if (!(_currentMenuBarItem is MenuBarItem))
+ {
+ var parent = _currentMenuBarItem.Parent as MenuBarItem;
+ int 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)
{
- Title = _frmMenuDetails.TextTitle.Text,
- Help = _frmMenuDetails.TextHelp.Text,
- Action = _frmMenuDetails.TextAction.Text,
- IsTopLevel = _frmMenuDetails.CkbIsTopLevel?.Checked ?? false,
- HasSubMenu = _frmMenuDetails.CkbSubMenu?.Checked ?? false,
- CheckStyle = _frmMenuDetails.RbChkStyle.SelectedItem == 0
- ? MenuItemCheckStyle.NoCheck
- : _frmMenuDetails.RbChkStyle.SelectedItem == 1
- ? MenuItemCheckStyle.Checked
- : MenuItemCheckStyle.Radio,
- Shortcut = _frmMenuDetails.TextShortcut.Text
- };
- UpdateMenuItem (_currentEditMenuBarItem, menuItem, _lstMenus.SelectedItem);
+ menuBarItem = new (
+ _currentMenuBarItem.Title,
+ new [] { newMenu },
+ _currentMenuBarItem.Parent
+ );
+ }
+ else if (menuBarItem.Children == null)
+ {
+ menuBarItem.Children = new [] { newMenu };
+ }
+ else
+ {
+ MenuItem [] childrens = menuBarItem.Children;
+ Array.Resize (ref childrens, childrens.Length + 1);
+ childrens [childrens.Length - 1] = newMenu;
+ menuBarItem.Children = childrens;
+ }
+
+ DataContext.Menus.Add (new() { Title = newMenu.Title, MenuItem = newMenu });
+ _lstMenus.MoveDown ();
}
};
- _btnAdd.Accept += (s, e) =>
- {
- if (MenuBar == null)
- {
- MessageBox.ErrorQuery ("Menu Bar Error", "Must add a MenuBar first!", "Ok");
- _btnAddMenuBar.SetFocus ();
-
- return;
- }
-
- var frameDetails = new DynamicMenuBarDetails (null, _currentMenuBarItem != null);
- DynamicMenuItem item = frameDetails.EnterMenuItem ();
-
- if (item == null)
- {
- return;
- }
-
- if (!(_currentMenuBarItem is MenuBarItem))
- {
- var parent = _currentMenuBarItem.Parent as MenuBarItem;
- int 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 [] { newMenu },
- _currentMenuBarItem.Parent
- );
- }
- else if (menuBarItem.Children == null)
- {
- menuBarItem.Children = new [] { newMenu };
- }
- else
- {
- MenuItem [] childrens = menuBarItem.Children;
- Array.Resize (ref childrens, childrens.Length + 1);
- childrens [childrens.Length - 1] = newMenu;
- menuBarItem.Children = childrens;
- }
-
- DataContext.Menus.Add (new DynamicMenuItemList { Title = newMenu.Title, MenuItem = newMenu });
- _lstMenus.MoveDown ();
- }
- };
-
_btnRemove.Accept += (s, e) =>
- {
- MenuItem menuItem = DataContext.Menus.Count > 0
- ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem
- : null;
+ {
+ MenuItem menuItem = DataContext.Menus.Count > 0
+ ? DataContext.Menus [_lstMenus.SelectedItem].MenuItem
+ : null;
- if (menuItem != null)
- {
- MenuItem [] childrens = ((MenuBarItem)_currentMenuBarItem).Children;
- childrens [_lstMenus.SelectedItem] = null;
- var i = 0;
+ if (menuItem != null)
+ {
+ MenuItem [] childrens = ((MenuBarItem)_currentMenuBarItem).Children;
+ childrens [_lstMenus.SelectedItem] = null;
+ var i = 0;
- foreach (MenuItem c in childrens)
- {
- if (c != null)
- {
- childrens [i] = c;
- i++;
- }
- }
+ foreach (MenuItem c in childrens)
+ {
+ if (c != null)
+ {
+ childrens [i] = c;
+ i++;
+ }
+ }
- Array.Resize (ref childrens, childrens.Length - 1);
+ Array.Resize (ref childrens, childrens.Length - 1);
- if (childrens.Length == 0)
- {
- if (_currentMenuBarItem.Parent == null)
- {
- ((MenuBarItem)_currentMenuBarItem).Children = null;
+ 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
- {
- Title = _currentEditMenuBarItem
- .Title
- }
- ),
- null,
- _currentMenuBarItem.Parent
- );
- }
- }
- else
- {
- ((MenuBarItem)_currentMenuBarItem).Children = childrens;
- }
+ //_currentMenuBarItem.Action = _frmMenuDetails.CreateAction (_currentEditMenuBarItem, new DynamicMenuItem (_currentMenuBarItem.Title));
+ }
+ else
+ {
+ _currentMenuBarItem = new (
+ _currentMenuBarItem.Title,
+ _currentMenuBarItem.Help,
+ _frmMenuDetails.CreateAction (
+ _currentEditMenuBarItem,
+ new()
+ {
+ Title = _currentEditMenuBarItem
+ .Title
+ }
+ ),
+ null,
+ _currentMenuBarItem.Parent
+ );
+ }
+ }
+ else
+ {
+ ((MenuBarItem)_currentMenuBarItem).Children = childrens;
+ }
- DataContext.Menus.RemoveAt (_lstMenus.SelectedItem);
+ DataContext.Menus.RemoveAt (_lstMenus.SelectedItem);
- if (_lstMenus.Source.Count > 0 && _lstMenus.SelectedItem > _lstMenus.Source.Count - 1)
- {
- _lstMenus.SelectedItem = _lstMenus.Source.Count - 1;
- }
+ if (_lstMenus.Source.Count > 0 && _lstMenus.SelectedItem > _lstMenus.Source.Count - 1)
+ {
+ _lstMenus.SelectedItem = _lstMenus.Source.Count - 1;
+ }
- _lstMenus.SetNeedsDisplay ();
- SetFrameDetails ();
- }
- };
+ _lstMenus.SetNeedsDisplay ();
+ SetFrameDetails ();
+ }
+ };
_lstMenus.OpenSelectedItem += (s, e) =>
{
@@ -978,7 +978,7 @@ public class DynamicMenuBar : Scenario
}
DataContext.Parent = _currentMenuBarItem.Title;
- DataContext.Menus = new List ();
+ DataContext.Menus = new ();
SetListViewSource (_currentMenuBarItem, true);
MenuItem menuBarItem = DataContext.Menus.Count > 0 ? DataContext.Menus [0].MenuItem : null;
SetFrameDetails (menuBarItem);
@@ -993,24 +993,24 @@ public class DynamicMenuBar : Scenario
};
_btnNext.Accept += (s, e) =>
- {
- if (_menuBar != null && _currentSelectedMenuBar + 1 < _menuBar.Menus.Length)
- {
- _currentSelectedMenuBar++;
- }
+ {
+ if (_menuBar != null && _currentSelectedMenuBar + 1 < _menuBar.Menus.Length)
+ {
+ _currentSelectedMenuBar++;
+ }
- SelectCurrentMenuBarItem ();
- };
+ SelectCurrentMenuBarItem ();
+ };
_btnPrevious.Accept += (s, e) =>
- {
- if (_currentSelectedMenuBar - 1 > -1)
- {
- _currentSelectedMenuBar--;
- }
+ {
+ if (_currentSelectedMenuBar - 1 > -1)
+ {
+ _currentSelectedMenuBar--;
+ }
- SelectCurrentMenuBarItem ();
- };
+ SelectCurrentMenuBarItem ();
+ };
_lblMenuBar.Enter += (s, e) =>
{
@@ -1022,89 +1022,89 @@ public class DynamicMenuBar : Scenario
};
_btnAddMenuBar.Accept += (s, e) =>
- {
- var frameDetails = new DynamicMenuBarDetails (null);
- DynamicMenuItem item = frameDetails.EnterMenuItem ();
+ {
+ var frameDetails = new DynamicMenuBarDetails (null);
+ DynamicMenuItem item = frameDetails.EnterMenuItem ();
- if (item == null)
- {
- return;
- }
+ if (item == null)
+ {
+ return;
+ }
- if (MenuBar == null)
- {
- _menuBar = new MenuBar ();
- Add (_menuBar);
- }
+ if (MenuBar == null)
+ {
+ _menuBar = new ();
+ Add (_menuBar);
+ }
- var newMenu = CreateNewMenu (item) as MenuBarItem;
+ var newMenu = CreateNewMenu (item) as MenuBarItem;
- MenuBarItem [] 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 ();
- };
+ MenuBarItem [] 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.Accept += (s, e) =>
- {
- if (_menuBar == null || _menuBar.Menus.Length == 0)
- {
- return;
- }
+ {
+ if (_menuBar == null || _menuBar.Menus.Length == 0)
+ {
+ return;
+ }
- if (_menuBar != null && _menuBar.Menus.Length > 0)
- {
- _menuBar.Menus [_currentSelectedMenuBar] = null;
- var i = 0;
+ if (_menuBar != null && _menuBar.Menus.Length > 0)
+ {
+ _menuBar.Menus [_currentSelectedMenuBar] = null;
+ var i = 0;
- foreach (MenuBarItem m in _menuBar.Menus)
- {
- if (m != null)
- {
- _menuBar.Menus [i] = m;
- i++;
- }
- }
+ foreach (MenuBarItem m in _menuBar.Menus)
+ {
+ if (m != null)
+ {
+ _menuBar.Menus [i] = m;
+ i++;
+ }
+ }
- MenuBarItem [] menus = _menuBar.Menus;
- Array.Resize (ref menus, menus.Length - 1);
- _menuBar.Menus = menus;
+ MenuBarItem [] menus = _menuBar.Menus;
+ Array.Resize (ref menus, menus.Length - 1);
+ _menuBar.Menus = menus;
- if (_currentSelectedMenuBar - 1 >= 0 && _menuBar.Menus.Length > 0)
- {
- _currentSelectedMenuBar--;
- }
+ if (_currentSelectedMenuBar - 1 >= 0 && _menuBar.Menus.Length > 0)
+ {
+ _currentSelectedMenuBar--;
+ }
- _currentMenuBarItem = _menuBar.Menus?.Length > 0
- ? _menuBar.Menus [_currentSelectedMenuBar]
- : null;
- }
+ _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 = string.Empty;
- }
- else
- {
- _lblMenuBar.Text = _menuBar.Menus [_currentSelectedMenuBar].Title;
- }
+ if (MenuBar != null && _currentMenuBarItem == null && _menuBar.Menus.Length == 0)
+ {
+ Remove (_menuBar);
+ _menuBar = null;
+ DataContext.Menus = new ();
+ _currentMenuBarItem = null;
+ _currentSelectedMenuBar = -1;
+ _lblMenuBar.Text = string.Empty;
+ }
+ else
+ {
+ _lblMenuBar.Text = _menuBar.Menus [_currentSelectedMenuBar].Title;
+ }
- SetListViewSource (_currentMenuBarItem, true);
- SetFrameDetails ();
- };
+ SetListViewSource (_currentMenuBarItem, true);
+ SetFrameDetails ();
+ };
SetFrameDetails ();
@@ -1153,14 +1153,14 @@ public class DynamicMenuBar : Scenario
SetFrameDetails (menuBarItem);
_currentMenuBarItem = menuBarItem;
- DataContext.Menus = new List ();
+ DataContext.Menus = new ();
SetListViewSource (_currentMenuBarItem, true);
_lblParent.Text = string.Empty;
}
void SetListViewSource (MenuItem _currentMenuBarItem, bool fill = false)
{
- DataContext.Menus = new List ();
+ DataContext.Menus = new ();
var menuBarItem = _currentMenuBarItem as MenuBarItem;
if (menuBarItem != null && menuBarItem?.Children == null)
@@ -1193,7 +1193,7 @@ public class DynamicMenuBar : Scenario
}
else if (parent != null)
{
- newMenu = new MenuItem (item.Title, item.Help, null, null, parent);
+ newMenu = new (item.Title, item.Help, null, null, parent);
newMenu.CheckType = item.CheckStyle;
newMenu.Action = _frmMenuDetails.CreateAction (newMenu, item);
newMenu.Shortcut = ShortcutHelper.GetShortcutFromTag (item.Shortcut);
@@ -1266,20 +1266,20 @@ public class DynamicMenuBar : Scenario
{
_frmMenuDetails.UpdateParent (ref _currentEditMenuBarItem);
- _currentEditMenuBarItem = new MenuItem (
- menuItem.Title,
- menuItem.Help,
- _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem),
- null,
- _currentEditMenuBarItem.Parent
- );
+ _currentEditMenuBarItem = new (
+ menuItem.Title,
+ menuItem.Help,
+ _frmMenuDetails.CreateAction (_currentEditMenuBarItem, menuItem),
+ null,
+ _currentEditMenuBarItem.Parent
+ );
}
else
{
if (_currentEditMenuBarItem is MenuBarItem)
{
((MenuBarItem)_currentEditMenuBarItem).Children = null;
- DataContext.Menus = new List ();
+ DataContext.Menus = new ();
}
_currentEditMenuBarItem.Action =
@@ -1298,7 +1298,7 @@ public class DynamicMenuBar : Scenario
if (DataContext.Menus.Count == 0)
{
DataContext.Menus.Add (
- new DynamicMenuItemList
+ new()
{
Title = _currentEditMenuBarItem.Title, MenuItem = _currentEditMenuBarItem
}
@@ -1306,7 +1306,7 @@ public class DynamicMenuBar : Scenario
}
DataContext.Menus [index] =
- new DynamicMenuItemList
+ new()
{
Title = _currentEditMenuBarItem.Title, MenuItem = _currentEditMenuBarItem
};
@@ -1362,7 +1362,7 @@ public class DynamicMenuBar : Scenario
PropertyChanged?.Invoke (
this,
- new PropertyChangedEventArgs (GetPropertyName ())
+ new (GetPropertyName ())
);
}
}
@@ -1381,7 +1381,7 @@ public class DynamicMenuBar : Scenario
PropertyChanged?.Invoke (
this,
- new PropertyChangedEventArgs (GetPropertyName ())
+ new (GetPropertyName ())
);
}
}
@@ -1400,7 +1400,7 @@ public class DynamicMenuBar : Scenario
PropertyChanged?.Invoke (
this,
- new PropertyChangedEventArgs (GetPropertyName ())
+ new (GetPropertyName ())
);
}
}
diff --git a/UICatalog/Scenarios/Editor.cs b/UICatalog/Scenarios/Editor.cs
index 85bcba8b9..21e4b249a 100644
--- a/UICatalog/Scenarios/Editor.cs
+++ b/UICatalog/Scenarios/Editor.cs
@@ -44,7 +44,7 @@ public class Editor : Scenario
Top = new ();
- Win = new Window
+ Win = new()
{
Title = _fileName ?? "Untitled",
X = 0,
@@ -55,7 +55,7 @@ public class Editor : Scenario
};
Top.Add (Win);
- _textView = new TextView
+ _textView = new()
{
X = 0,
Y = 0,
@@ -75,168 +75,168 @@ public class Editor : Scenario
{
Menus =
[
- new MenuBarItem (
- "_File",
- new MenuItem []
- {
- new ("_New", "", () => New ()),
- new ("_Open", "", () => Open ()),
- new ("_Save", "", () => Save ()),
- new ("_Save As", "", () => SaveAs ()),
- new ("_Close", "", () => CloseFile ()),
- null,
- new ("_Quit", "", () => Quit ())
- }
- ),
- new MenuBarItem (
- "_Edit",
- new MenuItem []
- {
- new (
- "_Copy",
- "",
- () => Copy (),
- null,
- null,
- KeyCode.CtrlMask | KeyCode.C
- ),
- new (
- "C_ut",
- "",
- () => Cut (),
- null,
- null,
- KeyCode.CtrlMask | KeyCode.W
- ),
- new (
- "_Paste",
- "",
- () => Paste (),
- null,
- null,
- KeyCode.CtrlMask | KeyCode.Y
- ),
- null,
- new (
- "_Find",
- "",
- () => Find (),
- null,
- null,
- KeyCode.CtrlMask | KeyCode.S
- ),
- new (
- "Find _Next",
- "",
- () => FindNext (),
- null,
- null,
- KeyCode.CtrlMask
- | KeyCode.ShiftMask
- | KeyCode.S
- ),
- new (
- "Find P_revious",
- "",
- () => FindPrevious (),
- null,
- null,
- KeyCode.CtrlMask
- | KeyCode.ShiftMask
- | KeyCode.AltMask
- | KeyCode.S
- ),
- new (
- "_Replace",
- "",
- () => Replace (),
- null,
- null,
- KeyCode.CtrlMask | KeyCode.R
- ),
- new (
- "Replace Ne_xt",
- "",
- () => ReplaceNext (),
- null,
- null,
- KeyCode.CtrlMask
- | KeyCode.ShiftMask
- | KeyCode.R
- ),
- new (
- "Replace Pre_vious",
- "",
- () => ReplacePrevious (),
- null,
- null,
- KeyCode.CtrlMask
- | KeyCode.ShiftMask
- | KeyCode.AltMask
- | KeyCode.R
- ),
- new (
- "Replace _All",
- "",
- () => ReplaceAll (),
- null,
- null,
- KeyCode.CtrlMask
- | KeyCode.ShiftMask
- | KeyCode.AltMask
- | KeyCode.A
- ),
- null,
- new (
- "_Select All",
- "",
- () => SelectAll (),
- null,
- null,
- KeyCode.CtrlMask | KeyCode.T
- )
- }
- ),
- new MenuBarItem ("_ScrollBarView", CreateKeepChecked ()),
- new MenuBarItem ("_Cursor", CreateCursorRadio ()),
- new MenuBarItem (
- "Forma_t",
- new []
- {
- CreateWrapChecked (),
- CreateAutocomplete (),
- CreateAllowsTabChecked (),
- CreateReadOnlyChecked ()
- }
- ),
- new MenuBarItem (
- "_Responder",
- new [] { CreateCanFocusChecked (), CreateEnabledChecked (), CreateVisibleChecked () }
- ),
- new MenuBarItem (
- "Conte_xtMenu",
- new []
- {
- _miForceMinimumPosToZero = new MenuItem (
- "ForceMinimumPosTo_Zero",
- "",
- () =>
- {
- _miForceMinimumPosToZero.Checked =
- _forceMinimumPosToZero =
- !_forceMinimumPosToZero;
+ new (
+ "_File",
+ new MenuItem []
+ {
+ new ("_New", "", () => New ()),
+ new ("_Open", "", () => Open ()),
+ new ("_Save", "", () => Save ()),
+ new ("_Save As", "", () => SaveAs ()),
+ new ("_Close", "", () => CloseFile ()),
+ null,
+ new ("_Quit", "", () => Quit ())
+ }
+ ),
+ new (
+ "_Edit",
+ new MenuItem []
+ {
+ new (
+ "_Copy",
+ "",
+ () => Copy (),
+ null,
+ null,
+ KeyCode.CtrlMask | KeyCode.C
+ ),
+ new (
+ "C_ut",
+ "",
+ () => Cut (),
+ null,
+ null,
+ KeyCode.CtrlMask | KeyCode.W
+ ),
+ new (
+ "_Paste",
+ "",
+ () => Paste (),
+ null,
+ null,
+ KeyCode.CtrlMask | KeyCode.Y
+ ),
+ null,
+ new (
+ "_Find",
+ "",
+ () => Find (),
+ null,
+ null,
+ KeyCode.CtrlMask | KeyCode.S
+ ),
+ new (
+ "Find _Next",
+ "",
+ () => FindNext (),
+ null,
+ null,
+ KeyCode.CtrlMask
+ | KeyCode.ShiftMask
+ | KeyCode.S
+ ),
+ new (
+ "Find P_revious",
+ "",
+ () => FindPrevious (),
+ null,
+ null,
+ KeyCode.CtrlMask
+ | KeyCode.ShiftMask
+ | KeyCode.AltMask
+ | KeyCode.S
+ ),
+ new (
+ "_Replace",
+ "",
+ () => Replace (),
+ null,
+ null,
+ KeyCode.CtrlMask | KeyCode.R
+ ),
+ new (
+ "Replace Ne_xt",
+ "",
+ () => ReplaceNext (),
+ null,
+ null,
+ KeyCode.CtrlMask
+ | KeyCode.ShiftMask
+ | KeyCode.R
+ ),
+ new (
+ "Replace Pre_vious",
+ "",
+ () => ReplacePrevious (),
+ null,
+ null,
+ KeyCode.CtrlMask
+ | KeyCode.ShiftMask
+ | KeyCode.AltMask
+ | KeyCode.R
+ ),
+ new (
+ "Replace _All",
+ "",
+ () => ReplaceAll (),
+ null,
+ null,
+ KeyCode.CtrlMask
+ | KeyCode.ShiftMask
+ | KeyCode.AltMask
+ | KeyCode.A
+ ),
+ null,
+ new (
+ "_Select All",
+ "",
+ () => SelectAll (),
+ null,
+ null,
+ KeyCode.CtrlMask | KeyCode.T
+ )
+ }
+ ),
+ new ("_ScrollBarView", CreateKeepChecked ()),
+ new ("_Cursor", CreateCursorRadio ()),
+ new (
+ "Forma_t",
+ new []
+ {
+ CreateWrapChecked (),
+ CreateAutocomplete (),
+ CreateAllowsTabChecked (),
+ CreateReadOnlyChecked ()
+ }
+ ),
+ new (
+ "_Responder",
+ new [] { CreateCanFocusChecked (), CreateEnabledChecked (), CreateVisibleChecked () }
+ ),
+ new (
+ "Conte_xtMenu",
+ new []
+ {
+ _miForceMinimumPosToZero = new (
+ "ForceMinimumPosTo_Zero",
+ "",
+ () =>
+ {
+ _miForceMinimumPosToZero.Checked =
+ _forceMinimumPosToZero =
+ !_forceMinimumPosToZero;
- _textView.ContextMenu.ForceMinimumPosToZero =
- _forceMinimumPosToZero;
- }
- )
- {
- CheckType = MenuItemCheckStyle.Checked,
- Checked = _forceMinimumPosToZero
- },
- new MenuBarItem ("_Languages", GetSupportedCultures ())
- }
- )
+ _textView.ContextMenu.ForceMinimumPosToZero =
+ _forceMinimumPosToZero;
+ }
+ )
+ {
+ CheckType = MenuItemCheckStyle.Checked,
+ Checked = _forceMinimumPosToZero
+ },
+ new MenuBarItem ("_Languages", GetSupportedCultures ())
+ }
+ )
]
};
@@ -272,7 +272,7 @@ public class Editor : Scenario
Top.Add (statusBar);
- _scrollBar = new ScrollBarView (_textView, true);
+ _scrollBar = new (_textView, true);
_scrollBar.ChangedPosition += (s, e) =>
{
@@ -376,7 +376,7 @@ public class Editor : Scenario
}
};
- Top.Closed += (s, e) => Thread.CurrentThread.CurrentUICulture = new CultureInfo ("en-US");
+ Top.Closed += (s, e) => Thread.CurrentThread.CurrentUICulture = new ("en-US");
}
public override void Setup () { }
@@ -584,7 +584,7 @@ public class Editor : Scenario
List