public void ExecuteMacros()
{
IsRecording = false;
UnderlayingControl.BeginUpdate();
UnderlayingControl.Selection.BeginUpdate();
UnderlayingControl.BeginAutoUndo();
foreach (var item in macro)
{
if (item is Keys)
{
UnderlayingControl.ProcessKey((Keys) item);
}
if (item is KeyValuePair<char, Keys>)
{
var p = (KeyValuePair<char, Keys>) item;
UnderlayingControl.ProcessKey(p.Key, p.Value);
}
}
UnderlayingControl.EndAutoUndo();
UnderlayingControl.Selection.EndUpdate();
UnderlayingControl.EndUpdate();
}