mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-11-24 04:12:32 +08:00
[Settings > Screen ruler] Fix disabled state of infobar (#20184)
* code changes * fix typo * Update src/settings-ui/Settings.UI.Library/ViewModels/MeasureToolViewModel.cs Co-authored-by: Andrey Nekrasov <yuyoyuppe@users.noreply.github.com>
This commit is contained in:
parent
f39691cdbc
commit
bc603f88ce
@ -52,6 +52,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
SendConfigMSG(outgoing.ToString());
|
||||
|
||||
NotifyPropertyChanged();
|
||||
NotifyPropertyChanged(nameof(ShowContinuousCaptureWarning));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -69,6 +70,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
{
|
||||
Settings.Properties.ContinuousCapture = value;
|
||||
NotifyPropertyChanged();
|
||||
NotifyPropertyChanged(nameof(ShowContinuousCaptureWarning));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,9 +164,21 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
|
||||
if (propertyName == nameof(ShowContinuousCaptureWarning))
|
||||
{
|
||||
// Don't trigger a settings update if the changed property is for visual notification.
|
||||
return;
|
||||
}
|
||||
|
||||
SettingsUtils.SaveSettings(Settings.ToJsonString(), MeasureToolSettings.ModuleName);
|
||||
}
|
||||
|
||||
public bool ShowContinuousCaptureWarning
|
||||
{
|
||||
get => IsEnabled && ContinuousCapture;
|
||||
}
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
}
|
||||
}
|
||||
|
@ -46,10 +46,9 @@
|
||||
<muxc:InfoBar
|
||||
Severity="Warning"
|
||||
x:Uid="MeasureTool_ContinuousCapture_Information"
|
||||
IsOpen="True"
|
||||
IsTabStop="True"
|
||||
IsClosable="False"
|
||||
Visibility="{Binding Mode=OneWay, Path=ContinuousCapture, Converter={StaticResource BoolToVisibilityConverter}}" />
|
||||
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowContinuousCaptureWarning}"
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowContinuousCaptureWarning}"
|
||||
IsClosable="False" />
|
||||
<controls:Setting x:Uid="MeasureTool_PerColorChannelEdgeDetection" Icon="">
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch
|
||||
|
Loading…
Reference in New Issue
Block a user