mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01: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:
@@ -52,6 +52,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
SendConfigMSG(outgoing.ToString());
|
SendConfigMSG(outgoing.ToString());
|
||||||
|
|
||||||
NotifyPropertyChanged();
|
NotifyPropertyChanged();
|
||||||
|
NotifyPropertyChanged(nameof(ShowContinuousCaptureWarning));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,6 +70,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
{
|
{
|
||||||
Settings.Properties.ContinuousCapture = value;
|
Settings.Properties.ContinuousCapture = value;
|
||||||
NotifyPropertyChanged();
|
NotifyPropertyChanged();
|
||||||
|
NotifyPropertyChanged(nameof(ShowContinuousCaptureWarning));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,9 +164,21 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
|||||||
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
public void NotifyPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
{
|
{
|
||||||
OnPropertyChanged(propertyName);
|
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);
|
SettingsUtils.SaveSettings(Settings.ToJsonString(), MeasureToolSettings.ModuleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShowContinuousCaptureWarning
|
||||||
|
{
|
||||||
|
get => IsEnabled && ContinuousCapture;
|
||||||
|
}
|
||||||
|
|
||||||
private Func<string, int> SendConfigMSG { get; }
|
private Func<string, int> SendConfigMSG { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,10 +46,9 @@
|
|||||||
<muxc:InfoBar
|
<muxc:InfoBar
|
||||||
Severity="Warning"
|
Severity="Warning"
|
||||||
x:Uid="MeasureTool_ContinuousCapture_Information"
|
x:Uid="MeasureTool_ContinuousCapture_Information"
|
||||||
IsOpen="True"
|
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.ShowContinuousCaptureWarning}"
|
||||||
IsTabStop="True"
|
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.ShowContinuousCaptureWarning}"
|
||||||
IsClosable="False"
|
IsClosable="False" />
|
||||||
Visibility="{Binding Mode=OneWay, Path=ContinuousCapture, Converter={StaticResource BoolToVisibilityConverter}}" />
|
|
||||||
<controls:Setting x:Uid="MeasureTool_PerColorChannelEdgeDetection" Icon="">
|
<controls:Setting x:Uid="MeasureTool_PerColorChannelEdgeDetection" Icon="">
|
||||||
<controls:Setting.ActionContent>
|
<controls:Setting.ActionContent>
|
||||||
<ToggleSwitch
|
<ToggleSwitch
|
||||||
|
|||||||
Reference in New Issue
Block a user