Skip to content

Commit dc3f663

Browse files
committed
Use property changed to change
1 parent a41356c commit dc3f663

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,16 @@ public bool HideNotifyIcon
275275
public bool LeaveCmdOpen { get; set; }
276276
public bool HideWhenDeactivated { get; set; } = true;
277277

278-
public bool SearchQueryResultsWithDelay { get; set; } = false;
278+
bool _searchQueryResultsWithDelay { get; set; }
279+
public bool SearchQueryResultsWithDelay
280+
{
281+
get => _searchQueryResultsWithDelay;
282+
set
283+
{
284+
_searchQueryResultsWithDelay = value;
285+
OnPropertyChanged();
286+
}
287+
}
279288
public int SearchInputDelay { get; set; } = 120;
280289

281290
[JsonConverter(typeof(JsonStringEnumConverter))]

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,9 @@ private void OnLoaded(object sender, RoutedEventArgs _)
297297
case nameof(Settings.WindowTop):
298298
Top = _settings.WindowTop;
299299
break;
300+
case nameof(Settings.SearchQueryResultsWithDelay):
301+
SetupSearchTextBoxReactiveness(_settings.SearchQueryResultsWithDelay);
302+
break;
300303
}
301304
};
302305
}
@@ -865,7 +868,7 @@ private void QueryTextBox_KeyUp(object sender, KeyEventArgs e)
865868

866869
private IDisposable _reactiveSubscription;
867870

868-
public void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
871+
private void SetupSearchTextBoxReactiveness(bool showResultsWithDelay)
869872
{
870873
if (_reactiveSubscription != null)
871874
{

Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,6 @@ public bool PortableMode
139139
}
140140
}
141141

142-
public bool SearchQueryResultsWithDelay
143-
{
144-
get => Settings.SearchQueryResultsWithDelay;
145-
set
146-
{
147-
Settings.SearchQueryResultsWithDelay = value;
148-
149-
((MainWindow)System.Windows.Application.Current.MainWindow).SetupSearchTextBoxReactiveness(value);
150-
}
151-
}
152-
153142
public IEnumerable<int> SearchInputDelayRange => new List<int>()
154143
{
155144
30, 60, 90, 120, 150, 180, 210, 240, 270, 300

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
Icon="&#xE961;"
179179
Sub="{DynamicResource searchDelayToolTip}">
180180
<ui:ToggleSwitch
181-
IsOn="{Binding SearchQueryResultsWithDelay}"
181+
IsOn="{Binding Settings.SearchQueryResultsWithDelay}"
182182
OffContent="{DynamicResource disable}"
183183
OnContent="{DynamicResource enable}" />
184184
</cc:Card>

0 commit comments

Comments
 (0)