protected static List<object> GetFilteredList(IList<NamedColor> originalList, MaterialWithUniformColor materialTemplate, string filterString) { var result = new List<object>(); filterString = filterString.ToLowerInvariant(); foreach (var namedColor in originalList) { if (namedColor.Name.ToLowerInvariant().StartsWith(filterString)) result.Add(materialTemplate.WithColor(namedColor)); } return result; }
protected virtual void OnSelectedMaterialChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { var oldMaterial = (IMaterial)args.OldValue; var newMaterial = (IMaterial)args.NewValue; var oldColor = oldMaterial.Color; var newColor = newMaterial.Color; if (newMaterial.Color.ParentColorSet == null) { StoreAsLastUsedItem(_lastLocalUsedItems, newMaterial); } else if (!newMaterial.HasSameSpecularPropertiesAs(_solidMaterialTemplate) && newMaterial.IsVisible) { // StoreAsLastUsedItem(_lastLocalUsedItems, newMaterial); _solidMaterialTemplate = (MaterialWithUniformColor)_solidMaterialTemplate.WithSpecularPropertiesAs(newMaterial); } if (!newMaterial.Equals(_guiComboBox.SelectedValue)) this.UpdateComboBoxSourceSelection(newMaterial); if (!object.ReferenceEquals(oldColor.ParentColorSet, newColor.ParentColorSet) && !object.ReferenceEquals(newColor.ParentColorSet, _treeView.SelectedValue)) this.UpdateTreeViewSelection(); if (null != SelectedMaterialChanged) SelectedMaterialChanged(obj, args); }