forked from BAndysc/WoWDatabaseEditor
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathSolutionFolderItem.cs
54 lines (43 loc) · 1.35 KB
/
SolutionFolderItem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text.Json.Serialization;
using WDE.Common;
namespace WDE.Solutions
{
public class SolutionFolderItem : ISolutionItem, IRenameableSolutionItem
{
public SolutionFolderItem(string name, IEnumerable<ISolutionItem> children)
{
MyName = name;
Items = new ObservableCollection<ISolutionItem>(children);
}
public SolutionFolderItem(string name)
{
MyName = name;
Items = new ObservableCollection<ISolutionItem>();
}
public SolutionFolderItem()
{
MyName = "";
Items = new ObservableCollection<ISolutionItem>();
}
public string MyName { get; set; }
[JsonIgnore]
public bool IsContainer => true;
public ObservableCollection<ISolutionItem> Items { get; }
[JsonIgnore]
public string? ExtraId => null;
[JsonIgnore]
public bool IsExportable => true;
public void AddItem(ISolutionItem item)
{
Items.Add(item);
}
public ISolutionItem Clone() => new SolutionFolderItem(MyName, Items.Select(i => i.Clone()));
public void Rename(string newName)
{
MyName = newName;
}
}
}