mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add numeric input restriction
This commit is contained in:
parent
df07a64661
commit
9285b9c5f4
3 changed files with 12 additions and 3 deletions
|
|
@ -525,12 +525,15 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public int MaxResultLowerLimit => 100;
|
||||
public int MaxResultUpperLimit => 100000;
|
||||
|
||||
public int MaxResult
|
||||
{
|
||||
get => Settings.MaxResult;
|
||||
set
|
||||
{
|
||||
Settings.MaxResult = Math.Clamp(value, 100, 10000);
|
||||
Settings.MaxResult = Math.Clamp(value, MaxResultLowerLimit, MaxResultUpperLimit);
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -363,6 +363,7 @@
|
|||
Margin="0,9,0,6"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
PreviewTextInput="AllowOnlyNumericInput"
|
||||
Text="{Binding MaxResult}"
|
||||
ToolTip="{DynamicResource plugin_explorer_Maximum_Results_Tooltip}"/>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks;
|
||||
using Flow.Launcher.Plugin.Explorer.ViewModels;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
|
@ -40,7 +40,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void AccessLinkDragDrop(string containerName, DragEventArgs e)
|
||||
{
|
||||
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
|
@ -94,5 +94,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
|
|||
{
|
||||
AccessLinkDragDrop("IndexSearchExcludedPath", e);
|
||||
}
|
||||
|
||||
private void AllowOnlyNumericInput(object sender, System.Windows.Input.TextCompositionEventArgs e)
|
||||
{
|
||||
e.Handled = e.Text.ToCharArray().Any(c => !char.IsDigit(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue