Skip to content

Commit

Permalink
- complete pass for the new style usage
Browse files Browse the repository at this point in the history
- observe nullables as files are modified

#1020
  • Loading branch information
Smurf-IV committed Jul 8, 2023
1 parent 7248c27 commit 444026e
Show file tree
Hide file tree
Showing 140 changed files with 1,193 additions and 1,276 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public override bool CanBeParentedTo(IDesigner parentDesigner) =>
/// <summary>
/// Gets the collection of components associated with the component managed by the designer.
/// </summary>
public override ICollection AssociatedComponents => _page != null ? _page.ButtonSpecs : base.AssociatedComponents;
public override ICollection AssociatedComponents => _page?.ButtonSpecs ?? base.AssociatedComponents;

/// <summary>
/// Gets the design-time action lists supported by the component associated with the designer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Krypton.Toolkit
internal class KryptonBreadCrumbItemDesigner : ComponentDesigner
{
#region Instance Fields
private KryptonBreadCrumbItem _crumbItem;
private KryptonBreadCrumbItem? _crumbItem;
private IComponentChangeService _changeService;
#endregion

Expand Down Expand Up @@ -48,7 +48,7 @@ public override ICollection AssociatedComponents
{
get
{
ArrayList compound = new ArrayList(base.AssociatedComponents);
var compound = new ArrayList(base.AssociatedComponents);

if (_crumbItem != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the button specific list
new KryptonButtonActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the checkbox specific list
new KryptonCheckBoxActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the check button specific list
new KryptonCheckButtonActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the panel specific list
new KryptonCheckSetActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the label specific list
new KryptonCheckedListBoxActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the color button specific list
new KryptonColorButtonActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class KryptonComboBoxDesigner : ControlDesigner
{
#region Instance Fields
private bool _lastHitTest;
private KryptonComboBox _comboBox;
private KryptonComboBox? _comboBox;
private IDesignerHost _designerHost;
private IComponentChangeService _changeService;
private ISelectionService _selectionService;
Expand Down Expand Up @@ -62,7 +62,7 @@ public override void Initialize([DisallowNull] IComponent component)
/// Gets the collection of components associated with the component managed by the designer.
/// </summary>
public override ICollection AssociatedComponents =>
_comboBox != null ? _comboBox.ButtonSpecs : base.AssociatedComponents;
_comboBox?.ButtonSpecs ?? base.AssociatedComponents;

/// <summary>
/// Gets the selection rules that indicate the movement capabilities of a component.
Expand All @@ -86,9 +86,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the label specific list
new KryptonComboBoxActionList(this)
};
Expand Down Expand Up @@ -144,15 +143,15 @@ private void OnComboBoxMouseUp(object sender, MouseEventArgs e)
if (e.Button == MouseButtons.Left)
{
// Get any component associated with the current mouse position
Component component = _comboBox?.DesignerComponentFromPoint(new Point(e.X, e.Y));
Component? component = _comboBox?.DesignerComponentFromPoint(new Point(e.X, e.Y));

if (component != null)
{
// Force the layout to be update for any change in selection
_comboBox.PerformLayout();
_comboBox!.PerformLayout();

// Select the component
ArrayList selectionList = new ArrayList
var selectionList = new ArrayList
{
component
};
Expand All @@ -164,7 +163,7 @@ private void OnComboBoxMouseUp(object sender, MouseEventArgs e)
private void OnComboBoxDoubleClick(object sender, Point pt)
{
// Get any component associated with the current mouse position
Component component = _comboBox?.DesignerComponentFromPoint(pt);
Component? component = _comboBox?.DesignerComponentFromPoint(pt);

if (component != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the palette specific list
new KryptonCommandActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Krypton.Toolkit
internal class KryptonContextMenuDesigner : ComponentDesigner
{
#region Instance Fields
private KryptonContextMenu _contextMenu;
private KryptonContextMenu? _contextMenu;
private IComponentChangeService _changeService;
#endregion

Expand Down Expand Up @@ -48,7 +48,7 @@ public override ICollection AssociatedComponents
{
get
{
ArrayList compound = new ArrayList(base.AssociatedComponents);
var compound = new ArrayList(base.AssociatedComponents);

if (_contextMenu != null)
{
Expand All @@ -67,7 +67,7 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{
// Add the palette specific list
new KryptonContextMenuActionList(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Krypton.Toolkit
internal class KryptonContextMenuItemDesigner : ComponentDesigner
{
#region Instance Fields
private KryptonContextMenuItem _contextMenuItem;
private KryptonContextMenuItem? _contextMenuItem;
private IComponentChangeService _changeService;
#endregion

Expand Down Expand Up @@ -48,7 +48,7 @@ public override ICollection AssociatedComponents
{
get
{
ArrayList compound = new ArrayList(base.AssociatedComponents);
var compound = new ArrayList(base.AssociatedComponents);

if (_contextMenuItem != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Krypton.Toolkit
internal class KryptonContextMenuItemsDesigner : ComponentDesigner
{
#region Instance Fields
private KryptonContextMenuItems _contextMenuItems;
private KryptonContextMenuItems? _contextMenuItems;
private IComponentChangeService _changeService;
#endregion

Expand Down Expand Up @@ -48,7 +48,7 @@ public override ICollection AssociatedComponents
{
get
{
ArrayList compound = new ArrayList(base.AssociatedComponents);
var compound = new ArrayList(base.AssociatedComponents);

if (_contextMenuItems != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class KryptonDateTimePickerDesigner : ControlDesigner
{
#region Instance Fields
private bool _lastHitTest;
private KryptonDateTimePicker _dateTimePicker;
private KryptonDateTimePicker? _dateTimePicker;
private IDesignerHost _designerHost;
private IComponentChangeService _changeService;
private ISelectionService _selectionService;
Expand Down Expand Up @@ -62,7 +62,7 @@ public override void Initialize([DisallowNull] IComponent component)
/// Gets the collection of components associated with the component managed by the designer.
/// </summary>
public override ICollection AssociatedComponents =>
_dateTimePicker != null ? _dateTimePicker.ButtonSpecs : base.AssociatedComponents;
_dateTimePicker?.ButtonSpecs ?? base.AssociatedComponents;

/// <summary>
/// Gets the design-time action lists supported by the component associated with the designer.
Expand All @@ -72,9 +72,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the bread crumb specific list
new KryptonDateTimePickerActionList(this)
};
Expand Down Expand Up @@ -163,15 +162,15 @@ private void OnDateTimePickerMouseUp(object sender, MouseEventArgs e)
if ((_dateTimePicker != null) && (e.Button == MouseButtons.Left))
{
// Get any component associated with the current mouse position
Component component = _dateTimePicker.DesignerComponentFromPoint(new Point(e.X, e.Y));
Component? component = _dateTimePicker.DesignerComponentFromPoint(new Point(e.X, e.Y));

if (component != null)
{
// Force the layout to be update for any change in selection
_dateTimePicker.PerformLayout();

// Select the component
ArrayList selectionList = new ArrayList
var selectionList = new ArrayList
{
component
};
Expand All @@ -183,7 +182,7 @@ private void OnDateTimePickerMouseUp(object sender, MouseEventArgs e)
private void OnDateTimePickerDoubleClick(object sender, Point pt)
{
// Get any component associated with the current mouse position
Component component = _dateTimePicker.DesignerComponentFromPoint(pt);
Component? component = _dateTimePicker.DesignerComponentFromPoint(pt);

if (component != null)
{
Expand All @@ -201,7 +200,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e)
if (e.Component == _dateTimePicker)
{
// Need access to host in order to delete a component
IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
var host = (IDesignerHost)GetService(typeof(IDesignerHost));

// We need to remove all the button spec instances
for (var i = _dateTimePicker.ButtonSpecs.Count - 1; i >= 0; i--)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal class KryptonDomainUpDownDesigner : ControlDesigner
{
#region Instance Fields
private bool _lastHitTest;
private KryptonDomainUpDown _domainUpDown;
private KryptonDomainUpDown? _domainUpDown;
private IDesignerHost _designerHost;
private IComponentChangeService _changeService;
private ISelectionService _selectionService;
Expand Down Expand Up @@ -62,7 +62,7 @@ public override void Initialize([DisallowNull] IComponent component)
/// Gets the collection of components associated with the component managed by the designer.
/// </summary>
public override ICollection AssociatedComponents =>
_domainUpDown != null ? _domainUpDown.ButtonSpecs : base.AssociatedComponents;
_domainUpDown?.ButtonSpecs ?? base.AssociatedComponents;

/// <summary>
/// Gets the selection rules that indicate the movement capabilities of a component.
Expand All @@ -89,9 +89,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the label specific list
new KryptonDomainUpDownActionList(this)
};
Expand Down Expand Up @@ -147,15 +146,15 @@ private void OnDomainUpDownMouseUp(object sender, MouseEventArgs e)
if ((_domainUpDown != null) && (e.Button == MouseButtons.Left))
{
// Get any component associated with the current mouse position
Component component = _domainUpDown.DesignerComponentFromPoint(new Point(e.X, e.Y));
Component? component = _domainUpDown.DesignerComponentFromPoint(new Point(e.X, e.Y));

if (component != null)
{
// Force the layout to be update for any change in selection
_domainUpDown.PerformLayout();

// Select the component
ArrayList selectionList = new ArrayList
var selectionList = new ArrayList
{
component
};
Expand All @@ -167,7 +166,7 @@ private void OnDomainUpDownMouseUp(object sender, MouseEventArgs e)
private void OnDomainUpDownDoubleClick(object sender, Point pt)
{
// Get any component associated with the current mouse position
Component component = _domainUpDown?.DesignerComponentFromPoint(pt);
Component? component = _domainUpDown?.DesignerComponentFromPoint(pt);

if (component != null)
{
Expand All @@ -185,7 +184,7 @@ private void OnComponentRemoving(object sender, ComponentEventArgs e)
if ((_domainUpDown != null) && (e.Component == _domainUpDown))
{
// Need access to host in order to delete a component
IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));
var host = (IDesignerHost)GetService(typeof(IDesignerHost));

// We need to remove all the button spec instances
for (var i = _domainUpDown.ButtonSpecs.Count - 1; i >= 0; i--)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{

// Add the drop down button specific list
new KryptonDropButtonActionList(this)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Krypton.Toolkit
internal class KryptonGroupBoxDesigner : ParentControlDesigner
{
#region Instance Fields
private KryptonGroupBox _groupBox;
private KryptonGroupBox? _groupBox;
private IDesignerHost _designerHost;
#endregion

Expand Down Expand Up @@ -83,7 +83,7 @@ public override DesignerActionListCollection ActionLists
get
{
// Create a collection of action lists
DesignerActionListCollection actionLists = new DesignerActionListCollection
var actionLists = new DesignerActionListCollection
{
// Add the group box specific list
new KryptonGroupBoxActionList(this)
Expand Down
Loading

0 comments on commit 444026e

Please sign in to comment.