Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'UVtools.Core/Managers/MaterialManager.cs')
-rw-r--r--UVtools.Core/Managers/MaterialManager.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/UVtools.Core/Managers/MaterialManager.cs b/UVtools.Core/Managers/MaterialManager.cs
index 461e7b3..397a633 100644
--- a/UVtools.Core/Managers/MaterialManager.cs
+++ b/UVtools.Core/Managers/MaterialManager.cs
@@ -39,13 +39,13 @@ namespace UVtools.Core.Managers
#region Members
- private ObservableCollection<Material> _materials = new();
+ private RangeObservableCollection<Material> _materials = new();
#endregion
#region Properties
- public ObservableCollection<Material> Materials
+ public RangeObservableCollection<Material> Materials
{
get => _materials;
set => RaiseAndSetIfChanged(ref _materials, value);
@@ -184,6 +184,11 @@ namespace UVtools.Core.Managers
if (save) Save();
}
+ public void RemoveRange(IEnumerable<Material> collection)
+ {
+ _materials.RemoveRange(collection);
+ }
+
public int Count => _materials.Count;
public bool IsReadOnly => false;
public int IndexOf(Material item) => _materials.IndexOf(item);
@@ -266,13 +271,11 @@ namespace UVtools.Core.Managers
}
}
- #endregion
-
public void SortByName()
{
- var materials = _materials.ToList();
- materials.Sort((material, material1) => string.Compare(material.Name, material1.Name, StringComparison.Ordinal));
- Materials = new ObservableCollection<Material>(materials);
+ _materials.Sort((material, material1) => string.Compare(material.Name, material1.Name, StringComparison.Ordinal));
}
+
+ #endregion
}
} \ No newline at end of file