Use property changed to change

This commit is contained in:
Jack251970 2025-03-16 10:25:22 +08:00
parent a41356c845
commit dc3f663947
4 changed files with 15 additions and 14 deletions

View file

@ -275,7 +275,16 @@ namespace Flow.Launcher.Infrastructure.UserSettings
public bool LeaveCmdOpen { get; set; }
public bool HideWhenDeactivated { get; set; } = true;
public bool SearchQueryResultsWithDelay { get; set; } = false;
bool _searchQueryResultsWithDelay { get; set; }
public bool SearchQueryResultsWithDelay
{
get => _searchQueryResultsWithDelay;
set
{
_searchQueryResultsWithDelay = value;
OnPropertyChanged();
}
}
public int SearchInputDelay { get; set; } = 120;
[JsonConverter(typeof(JsonStringEnumConverter))]

View file

@ -297,6 +297,9 @@ namespace Flow.Launcher
case nameof(Settings.WindowTop):
Top = _settings.WindowTop;
break;
case nameof(Settings.SearchQueryResultsWithDelay):
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay);
break;
}
};
}
@ -865,7 +868,7 @@ namespace Flow.Launcher
private IDisposable _reactiveSubscription;
public void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
{
if (_reactiveSubscription != null)
{

View file

@ -139,17 +139,6 @@ public partial class SettingsPaneGeneralViewModel : BaseModel
}
}
public bool SearchQueryResultsWithDelay
{
get => Settings.SearchQueryResultsWithDelay;
set
{
Settings.SearchQueryResultsWithDelay = value;
((MainWindow)System.Windows.Application.Current.MainWindow).SetupSearchTextBoxReactiveness(value);
}
}
public IEnumerable<int> SearchInputDelayRange => new List<int>()
{
30, 60, 90, 120, 150, 180, 210, 240, 270, 300

View file

@ -178,7 +178,7 @@
Icon="&#xE961;"
Sub="{DynamicResource searchDelayToolTip}">
<ui:ToggleSwitch
IsOn="{Binding SearchQueryResultsWithDelay}"
IsOn="{Binding Settings.SearchQueryResultsWithDelay}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>