try to do better with merging command items

This commit is contained in:
Michael Becker 2020-09-23 01:41:52 -04:00
parent 82c9c2dc42
commit 10cc629ba1
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -172,7 +172,13 @@ namespace UniversalEditor.UserInterface.Common
string id = tagCommand.Attributes["ID"]?.Value;
string title = tagCommand.Attributes["Title"]?.Value;
Command cmd = new Command(id, title != null ? title : id);
Command cmd = er.Commands[id];
if (cmd == null)
{
cmd = new Command(id, title != null ? title : id);
er.Commands.Add(cmd);
}
MarkupTagElement tagItems = tagCommand.Elements["Items"] as MarkupTagElement;
if (tagItems != null)
{
@ -182,11 +188,9 @@ namespace UniversalEditor.UserInterface.Common
if (tagItem == null) continue;
CommandItem ci = CommandItem.FromMarkup(tagItem);
if (ci != null)
cmd.Items.Add(ci);
CommandItem.AddToCommandBar(ci, cmd, null);
}
}
er.Commands.Add(cmd);
}
}
}