From 644c56026ad6b1bd92250db946ae36978c8a77b1 Mon Sep 17 00:00:00 2001 From: DB p Date: Mon, 10 Oct 2022 15:33:33 +0900 Subject: [PATCH] - Add MaxWidth Limit - Size reflect to Slider --- Flow.Launcher/ViewModel/MainViewModel.cs | 17 ++++++++++++++--- .../ViewModel/SettingWindowViewModel.cs | 3 +++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index e61b84046..0f2749acf 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -62,6 +62,13 @@ namespace Flow.Launcher.ViewModel _lastQuery = new Query(); _settings = settings; + _settings.PropertyChanged += (_, args) => + { + if (args.PropertyName == nameof(Settings.WindowSize)) + { + OnPropertyChanged(nameof(MainWindowWidth)); + } + }; _historyItemsStorage = new FlowLauncherJsonStorage(); _userSelectedRecordStorage = new FlowLauncherJsonStorage(); @@ -356,21 +363,25 @@ namespace Flow.Launcher.ViewModel [RelayCommand] private void IncreaseWidth() { - MainWindowWidth += 100; + if (_settings.WindowSize > 1920) return; + _settings.WindowSize += 100; Left -= 50; + OnPropertyChanged(); } [RelayCommand] private void DecreaseWidth() { - if (MainWindowWidth < 400) return; + if (_settings.WindowSize < 400) return; Left += 50; - MainWindowWidth -= 100; + _settings.WindowSize -= 100; + OnPropertyChanged(); } [RelayCommand] private void IncreaseMaxResult() { + if (_settings.MaxResultsToShow > 17) return; _settings.MaxResultsToShow += 1; } diff --git a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs index 64cb9e36c..49a184e21 100644 --- a/Flow.Launcher/ViewModel/SettingWindowViewModel.cs +++ b/Flow.Launcher/ViewModel/SettingWindowViewModel.cs @@ -41,6 +41,9 @@ namespace Flow.Launcher.ViewModel case nameof(Settings.ActivateTimes): OnPropertyChanged(nameof(ActivatedTimes)); break; + case nameof(Settings.WindowSize): + OnPropertyChanged(nameof(WindowWidthSize)); + break; } }; }