mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
Compare commits
1 Commits
fix/imagec
...
feat/sugge
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fa4281a0a |
@@ -48,7 +48,7 @@ internal sealed partial class AutoSuggestTokenBox : TokenizingTextBox
|
|||||||
|
|
||||||
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
if (args.Reason == AutoSuggestionBoxTextChangeReason.UserInput)
|
||||||
{
|
{
|
||||||
sender.ItemsSource = AvailableTokens.Values.Where(q => q.Value.Contains(Text, StringComparison.OrdinalIgnoreCase));
|
sender.ItemsSource = AvailableTokens.Values.WhereOrDefault(q => q.Value.Contains(Text, StringComparison.OrdinalIgnoreCase), [SearchToken.NotFound]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace Snap.Hutao.Control.AutoSuggestBox;
|
|||||||
|
|
||||||
internal sealed class SearchToken
|
internal sealed class SearchToken
|
||||||
{
|
{
|
||||||
|
public static readonly SearchToken NotFound = new(SearchTokenKind.None, SH.ControlAutoSuggestBoxNotFoundValue);
|
||||||
|
|
||||||
public SearchToken(SearchTokenKind kind, string value, Uri? iconUri = null, Uri? sideIconUri = null, Color? quality = null)
|
public SearchToken(SearchTokenKind kind, string value, Uri? iconUri = null, Uri? sideIconUri = null, Color? quality = null)
|
||||||
{
|
{
|
||||||
Value = value;
|
Value = value;
|
||||||
|
|||||||
@@ -123,4 +123,9 @@ internal static partial class EnumerableExtension
|
|||||||
{
|
{
|
||||||
return string.Join(separator, collection);
|
return string.Join(separator, collection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<TSource> WhereOrDefault<TSource>(this IEnumerable<TSource> source, Func<TSource, bool> predicate, IEnumerable<TSource> defaultValue)
|
||||||
|
{
|
||||||
|
return source.Where(predicate).Any() ? source : defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -144,6 +144,9 @@
|
|||||||
<data name="ContentDialogSavePrimaryButtonText" xml:space="preserve">
|
<data name="ContentDialogSavePrimaryButtonText" xml:space="preserve">
|
||||||
<value>Save</value>
|
<value>Save</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ControlAutoSuggestBoxNotFoundValue" xml:space="preserve">
|
||||||
|
<value>No results found</value>
|
||||||
|
</data>
|
||||||
<data name="ControlImageCachedImageInvalidResourceUri" xml:space="preserve">
|
<data name="ControlImageCachedImageInvalidResourceUri" xml:space="preserve">
|
||||||
<value>Invalid Uri</value>
|
<value>Invalid Uri</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -144,6 +144,9 @@
|
|||||||
<data name="ContentDialogSavePrimaryButtonText" xml:space="preserve">
|
<data name="ContentDialogSavePrimaryButtonText" xml:space="preserve">
|
||||||
<value>保存</value>
|
<value>保存</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ControlAutoSuggestBoxNotFoundValue" xml:space="preserve">
|
||||||
|
<value>未找到结果</value>
|
||||||
|
</data>
|
||||||
<data name="ControlImageCachedImageInvalidResourceUri" xml:space="preserve">
|
<data name="ControlImageCachedImageInvalidResourceUri" xml:space="preserve">
|
||||||
<value>无效的 Uri</value>
|
<value>无效的 Uri</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user