public static bool Undo()
{
bool res = Execute(OnUndo);
if (!res)
{
Control activeControl = Application.ActiveControl;
if (activeControl == null)
{
return(false);
}
System.Windows.Forms.TextBoxBase active = activeControl as System.Windows.Forms.TextBoxBase;
res = active != null;
if (res)
{
active.Undo();
}
else
{
MethodInfo method = activeControl.GetType().GetMethod("Undo");
if (method != null)
{
Clipboard.FunctionWithoutReturn getMethod = (Clipboard.FunctionWithoutReturn)Delegate.CreateDelegate
(typeof(Clipboard.FunctionWithoutReturn), activeControl, method);
getMethod();
res = true;
}
}
}
return(res);
}