Skip to content

Commit

Permalink
code refactoring due to dotnet/roslyn#59336
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown6656 committed Feb 12, 2022
1 parent ebf2e13 commit 300e1ed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions Unknown6656.Core/Controls/Console/ControlHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -839,13 +839,13 @@ public Control(ControlHost host)
{
Host = host;

IsVisibleChanged += delegate { RequestRender(); };
BackgroundChanged += delegate { RequestRender(); };
ForegroundChanged += delegate { RequestRender(); };
BorderStyleChanged += delegate { RequestRender(); };
RenderableAbsoluteClientAreaChanged += delegate { RequestRender(); };
FocusedStyleChanged += delegate { RequestRender(); };
FocusAcquired += delegate { RequestRender(); };
IsVisibleChanged += (_, _) => RequestRender();
BackgroundChanged += (_, _) => RequestRender();
ForegroundChanged += (_, _) => RequestRender();
BorderStyleChanged += (_, _) => RequestRender();
RenderableAbsoluteClientAreaChanged += (_, _) => RequestRender();
FocusedStyleChanged += (_, _) => RequestRender();
FocusAcquired += (_, _) => RequestRender();
}

public override string ToString() => $"({Left},{Top}: {Width}x{Height}{(IsFocused ? 'F' : FocusBehaviour switch { FocusBehaviour.Focusable => 'f', FocusBehaviour.PassFocusThrough => 'p', _ => 'n' })}) {GetType().Name}: {Text}";
Expand Down Expand Up @@ -1288,7 +1288,7 @@ public ContainerControl(ControlHost host)
{
FocusedStyle = FocusedStyle.RenderAsNormal;
FocusBehaviour = FocusBehaviour.PassFocusThrough;
ChildCollectionChanged += delegate { RequestRender(); };
ChildCollectionChanged += (_, _) => RequestRender();
FocusAcquired += ContainerControl_FocusAcquired;
ChildRelativeZIndexChanged += Child_Invalidated;
ChildAbsolutePositionChanged += Child_Invalidated;
Expand Down
26 changes: 13 additions & 13 deletions Unknown6656.Core/Controls/Console/Controls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ public TextBox(ControlHost host)
BorderStyle = BorderStyle.TextBox;
FocusBehaviour = FocusBehaviour.Focusable;
FocusedStyle = FocusedStyle.RenderAsNormal;
SelectionChanged += delegate { RequestRender(); };
SelectionChanged += (_, _) => RequestRender();
BorderStyleChanged += TextBoxLayoutChanged;
AutosizeChanged += TextBoxLayoutChanged;
TextChanged += TextBox_TextChanged;
KeyPress += TextBox_KeyPress;
host.BlinkEvent += delegate { RequestRender(); };
host.BlinkEvent += (_, _) => RequestRender();
}

private void TextBox_KeyPress(Control sender, ConsoleKeyInfo key, ref bool handled)
Expand Down Expand Up @@ -304,7 +304,7 @@ public CheckBox(ControlHost host)
AutosizeChanged += CheckBoxLayoutChanged;
TextChanged += CheckBoxLayoutChanged;
KeyPress += CheckBox_KeyPress;
CheckedChanged += delegate { RequestRender(); };
CheckedChanged += (_, _) => RequestRender();
}

private void CheckBoxLayoutChanged<T>(Control sender, T _)
Expand Down Expand Up @@ -415,7 +415,7 @@ public OptionBox(ControlHost host)
AutosizeChanged += OptionBoxLayoutChanged;
TextChanged += OptionBoxLayoutChanged;
OptionsChanged += OptionBoxLayoutChanged;
SelectedOptionIndexChanged += delegate { RequestRender(); };
SelectedOptionIndexChanged += (_, _) => RequestRender();
KeyPress += OptionBox_KeyPress;
}

Expand Down Expand Up @@ -491,10 +491,10 @@ public StackPanel(ControlHost host)
: base(host)
{
BorderStyle = BorderStyle.None;
BorderStyleChanged += delegate { UpdateSize(); };
ChildCollectionChanged += delegate { UpdateSize(); };
ChildAbsolutePositionChanged += delegate { UpdateSize(); };
ChildSizeChanged += delegate { UpdateSize(); };
BorderStyleChanged += (_, _) => UpdateSize();
ChildCollectionChanged += (_, _) => UpdateSize();
ChildAbsolutePositionChanged += (_, _) => UpdateSize();
ChildSizeChanged += (_, _) => UpdateSize();
}

private void UpdateSize()
Expand Down Expand Up @@ -566,8 +566,8 @@ public ProgressBar(ControlHost host)
BorderStyle = BorderStyle.Rounded;
FocusBehaviour = FocusBehaviour.NonFocusable;
Size = new Size(12, 3);
ValueChanged += delegate { RequestRender(); };
DisplayPercentageChanged += delegate { RequestRender(); };
ValueChanged += (_, _) => RequestRender();
DisplayPercentageChanged += (_, _) => RequestRender();
}

protected override void InternalRender(RenderInformation render_information)
Expand Down Expand Up @@ -677,9 +677,9 @@ public ColorPicker(ControlHost host)
CanChangeText = false;
BorderStyle = BorderStyle.Rounded;
FocusedStyle = FocusedStyle.RenderAsNormal;
PickedColorChanged += delegate { RequestRender(); };
SelectedHexIndexChanged += delegate { RequestRender(); };
SelectedChannelIndexChanged += delegate { RequestRender(); };
PickedColorChanged += (_, _) => RequestRender();
SelectedHexIndexChanged += (_, _) => RequestRender();
SelectedChannelIndexChanged += (_, _) => RequestRender();
KeyPress += ColorPicker_KeyPress;
}

Expand Down

0 comments on commit 300e1ed

Please sign in to comment.