From 10b1bf871abd259bb182c8e119d80c3ee56144f8 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Sun, 20 Sep 2020 01:08:03 -0400 Subject: [PATCH] preliminary implementation of FindInternal for PropertyListObjectModel --- .../PropertyList/PropertyListObjectModel.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListObjectModel.cs b/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListObjectModel.cs index fb6e9984..0f44ccf8 100644 --- a/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListObjectModel.cs +++ b/Libraries/UniversalEditor.Essential/ObjectModels/PropertyList/PropertyListObjectModel.cs @@ -20,6 +20,7 @@ // along with this program. If not, see . using System; +using System.Collections.Generic; using System.Reflection; namespace UniversalEditor.ObjectModels.PropertyList @@ -263,5 +264,36 @@ namespace UniversalEditor.ObjectModels.PropertyList private string mvarTitle = String.Empty; public string Title { get { return mvarTitle; } set { mvarTitle = value; } } + + private CriteriaObject[] _CriteriaObjects = null; + private CriteriaProperty propName = new CriteriaProperty("Name", typeof(string)); + protected override CriteriaObject[] GetCriteriaObjectsInternal() + { + if (_CriteriaObjects == null) + { + _CriteriaObjects = new CriteriaObject[] + { + new CriteriaObject("Property", new CriteriaProperty[] + { + propName, + new CriteriaProperty("Value", typeof(string)) + }) + }; + } + return _CriteriaObjects; + } + protected override CriteriaResult[] FindInternal(CriteriaQuery query) + { + List list = new List(); + for (int i = 0; i < this.Items.Count; i++) + { + if (query.Check(propName, this.Items[i].Name)) + { + list.Add(new CriteriaResult(this.Items[i])); + break; + } + } + return list.ToArray(); + } } }