Skip to content

Commit 644c560

Browse files
committed
- Add MaxWidth Limit
- Size reflect to Slider
1 parent 753e261 commit 644c560

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ public MainViewModel(Settings settings)
6262
_lastQuery = new Query();
6363

6464
_settings = settings;
65+
_settings.PropertyChanged += (_, args) =>
66+
{
67+
if (args.PropertyName == nameof(Settings.WindowSize))
68+
{
69+
OnPropertyChanged(nameof(MainWindowWidth));
70+
}
71+
};
6572

6673
_historyItemsStorage = new FlowLauncherJsonStorage<History>();
6774
_userSelectedRecordStorage = new FlowLauncherJsonStorage<UserSelectedRecord>();
@@ -356,21 +363,25 @@ public double Left
356363
[RelayCommand]
357364
private void IncreaseWidth()
358365
{
359-
MainWindowWidth += 100;
366+
if (_settings.WindowSize > 1920) return;
367+
_settings.WindowSize += 100;
360368
Left -= 50;
369+
OnPropertyChanged();
361370
}
362371

363372
[RelayCommand]
364373
private void DecreaseWidth()
365374
{
366-
if (MainWindowWidth < 400) return;
375+
if (_settings.WindowSize < 400) return;
367376
Left += 50;
368-
MainWindowWidth -= 100;
377+
_settings.WindowSize -= 100;
378+
OnPropertyChanged();
369379
}
370380

371381
[RelayCommand]
372382
private void IncreaseMaxResult()
373383
{
384+
if (_settings.MaxResultsToShow > 17) return;
374385
_settings.MaxResultsToShow += 1;
375386
}
376387

Flow.Launcher/ViewModel/SettingWindowViewModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public SettingWindowViewModel(Updater updater, IPortable portable)
4141
case nameof(Settings.ActivateTimes):
4242
OnPropertyChanged(nameof(ActivatedTimes));
4343
break;
44+
case nameof(Settings.WindowSize):
45+
OnPropertyChanged(nameof(WindowWidthSize));
46+
break;
4447
}
4548
};
4649
}

0 commit comments

Comments
 (0)