Fixes #3209 - Formalize Cancellable Work Pattern and add helpers (#4092)

This commit is contained in:
Tig
2025-06-03 08:12:57 -06:00
committed by GitHub
parent 7490ac9776
commit 764a804ddd
127 changed files with 3720 additions and 1421 deletions

View File

@@ -64,7 +64,7 @@ public class Shortcuts : Scenario
{
Text = "_Align Keys",
CanFocus = false,
HighlightStyle = HighlightStyle.None
HighlightStates = MouseState.None
},
Key = Key.F5.WithCtrl.WithAlt.WithShift
};
@@ -85,7 +85,7 @@ public class Shortcuts : Scenario
v => v is Shortcut { Width: not DimAbsolute });
IEnumerable<View> enumerable = toAlign as View [] ?? toAlign.ToArray ();
if (e.NewValue == CheckState.Checked)
if (e.Result == CheckState.Checked)
{
max = (from Shortcut? peer in enumerable
select peer.Key.ToString ().GetColumns ()).Prepend (max)
@@ -118,7 +118,7 @@ public class Shortcuts : Scenario
{
Text = "Command _First",
CanFocus = false,
HighlightStyle = HighlightStyle.None
HighlightStates = MouseState.None
},
Key = Key.F.WithCtrl
};
@@ -143,7 +143,7 @@ public class Shortcuts : Scenario
{
var peer = (Shortcut)view;
if (e.NewValue == CheckState.Checked)
if (e.Result == CheckState.Checked)
{
peer.AlignmentModes &= ~AlignmentModes.EndToStart;
}
@@ -181,7 +181,7 @@ public class Shortcuts : Scenario
{
if (peer.CanFocus)
{
peer.CommandView.CanFocus = e.NewValue == CheckState.Checked;
peer.CommandView.CanFocus = e.Result == CheckState.Checked;
}
}
}
@@ -213,7 +213,7 @@ public class Shortcuts : Scenario
{
Title = "_Button",
ShadowStyle = ShadowStyle.None,
HighlightStyle = HighlightStyle.None
HighlightStates = MouseState.None
},
Key = Key.K
};
@@ -449,7 +449,7 @@ public class Shortcuts : Scenario
{
if (o is { })
{
eventSource.Add ($"ColorChanged: {o.GetType ().Name} - {args.CurrentValue}");
eventSource.Add ($"ColorChanged: {o.GetType ().Name} - {args.Result}");
eventLog.MoveDown ();
Application.Top.SetScheme (
@@ -457,7 +457,7 @@ public class Shortcuts : Scenario
{
Normal = new (
Application.Top!.GetAttributeForRole (VisualRole.Normal).Foreground,
args.CurrentValue,
args.Result,
Application.Top!.GetAttributeForRole (VisualRole.Normal).Style)
});
}