21 行
725 B
C#
21 行
725 B
C#
using YukkuriMovieMaker.Commons;
|
|
|
|
namespace UndoTree;
|
|
|
|
internal class UndoTreeFilter : Bindable
|
|
{
|
|
public string SearchText { get; set => Set(ref field, value ?? string.Empty, nameof(SearchText), nameof(IsActive)); } = string.Empty;
|
|
|
|
public bool IsActive => SearchText.Trim().Length > 0;
|
|
|
|
public bool IsMatch(UndoTreeNodeViewModel node)
|
|
{
|
|
if (!IsActive)
|
|
return true;
|
|
|
|
var text = SearchText.Trim();
|
|
return node.Text.Contains(text, StringComparison.CurrentCultureIgnoreCase)
|
|
|| node.Commands.Any(command => command.Text.Contains(text, StringComparison.CurrentCultureIgnoreCase) || command.Detail.Contains(text, StringComparison.CurrentCultureIgnoreCase));
|
|
}
|
|
}
|