Add bulk editing of roles

This commit is contained in:
Brant Martin
2019-04-22 15:44:34 -04:00
parent 56f7578d13
commit 92406a051a
2 changed files with 24 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ namespace Torch.Server.Views
private Type _itemType;
private Action _commitChanges;
public MyPromoteLevel BulkPromote { get; set; } = MyPromoteLevel.Scripter;
public void Edit(IDictionary dict)
{
@@ -106,5 +107,17 @@ namespace Torch.Server.Views
{
Items.Add((IDictionaryItem)Activator.CreateInstance(_itemType));
}
private void BulkEdit(object sender, RoutedEventArgs e)
{
List<ulong> l = Items.Where(i => i.Value.Equals(BulkPromote)).Select(i => (ulong)i.Key).ToList();
var w = new CollectionEditor();
w.Edit((ICollection<ulong>)l, "Bulk edit");
var r = Items.Where(j => j.Value.Equals(BulkPromote) || l.Contains((ulong)j.Key)).ToList();
foreach (var k in r)
Items.Remove(k);
foreach (var m in l)
Items.Add(new DictionaryItem<ulong, MyPromoteLevel>(m, BulkPromote));
}
}
}