From 269e583ea7629c3b1bfd6bc945c39ac026bbe11d Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 24 Dec 2024 11:54:15 +0800 Subject: [PATCH] Add maximum score to the results for developers. --- Flow.Launcher.Plugin/Result.cs | 5 +++++ Flow.Launcher/ViewModel/MainViewModel.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Plugin/Result.cs b/Flow.Launcher.Plugin/Result.cs index 669927072..f2050cc9f 100644 --- a/Flow.Launcher.Plugin/Result.cs +++ b/Flow.Launcher.Plugin/Result.cs @@ -268,6 +268,11 @@ namespace Flow.Launcher.Plugin /// public bool AddSelectedCount { get; set; } = true; + /// + /// Maximum score. This can be useful when set one result to the top by default. This is the score for the results set to the topmost by users. + /// + public const int MaxScore = int.MaxValue; + /// /// Info of the preview section of a /// diff --git a/Flow.Launcher/ViewModel/MainViewModel.cs b/Flow.Launcher/ViewModel/MainViewModel.cs index 6458316bb..e369a1fea 100644 --- a/Flow.Launcher/ViewModel/MainViewModel.cs +++ b/Flow.Launcher/ViewModel/MainViewModel.cs @@ -1471,9 +1471,9 @@ namespace Flow.Launcher.ViewModel { if (_topMostRecord.IsTopMost(result)) { - result.Score = int.MaxValue; + result.Score = Result.MaxScore; } - else if (result.Score != int.MaxValue) + else if (result.Score != Result.MaxScore) { var priorityScore = metaResults.Metadata.Priority * 150; result.Score += result.AddSelectedCount ?