AlgoTemplateToolBar - execute RevertDefinition visual state transitions through InvokeAsync
This commit is contained in:
1 parent
b6a28af99e
commit
f2bb8de4e1
1 file changed
+4
-4
@@ -124,7 +124,7 @@ namespace mbts.ui.spark.algo {
|
||||
public static readonly DependencyProperty ShowRevertDefinitionProperty =
|
||||
WPFHelper.create_dp<bool, AlgoTemplateToolBar>(
|
||||
nameof(ShowRevertDefinition),
|
||||
(o, v) => VisualStateNames.RevertDefinition.apply(o._vsm, v),
|
||||
VisualStateNames.RevertDefinition.apply,
|
||||
coerce_require_persisted);
|
||||
|
||||
public bool ShowRevertDefinition { get => (bool)GetValue(ShowRevertDefinitionProperty); set => SetValue(ShowRevertDefinitionProperty, value); }
|
||||
@@ -435,7 +435,7 @@ namespace mbts.ui.spark.algo {
|
||||
public static class VisualStateNames {
|
||||
public static void apply_all(AlgoTemplateToolBar toolbar) {
|
||||
UndoRedo.apply(toolbar._vsm, toolbar.ShowUndoRedoButtons);
|
||||
RevertDefinition.apply(toolbar._vsm, toolbar.ShowRevertDefinition);
|
||||
RevertDefinition.apply(toolbar, toolbar.ShowRevertDefinition);
|
||||
RenameDefinition.apply(toolbar._vsm, toolbar.ShowRenameDefinition);
|
||||
SaveDefinition.apply(toolbar._vsm, toolbar.ShowSaveDefinition);
|
||||
TemplatesDropDown.apply(toolbar._vsm, toolbar.ShowTemplatesDropDown);
|
||||
@@ -457,8 +457,8 @@ namespace mbts.ui.spark.algo {
|
||||
Active = $"{GroupName}{VisualStates.Active}",
|
||||
Inactive = $"{GroupName}{VisualStates.Inactive}";
|
||||
|
||||
public static void apply(VisualStateModel vsm, bool active) =>
|
||||
vsm.set_state(GroupName, active ? Active : Inactive);
|
||||
public static void apply(AlgoTemplateToolBar owner, bool active) =>
|
||||
owner.Dispatcher.InvokeAsync(() => owner._vsm.set_state(GroupName, active ? Active : Inactive));
|
||||
}
|
||||
public static class RenameDefinition {
|
||||
public const string GroupName = nameof(RenameDefinition);
|
||||
|
||||
Reference in new issue
Block a user