/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, Color transparentColor, string name, string description, bool isChecked, bool isFeasible, Permission requiredPermission, ActionExecuteDelegate executeDelegate) : this( title, image, transparentColor, name, description, isChecked, isFeasible, requiredPermission, null, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, ActionExecuteDelegate executeDelegate) : this( title, image, Color.Empty, string.Format("{0} Action", title), description, false, isFeasible, requiredPermission, null, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> protected DelegateMenuItemDef(string title, Bitmap image, Color transparentColor, string name, string description, bool isChecked, bool isFeasible, Permission requiredPermission, char securityDomainName, ActionExecuteDelegate executeDelegate) : base(title, image, transparentColor, name, description, isChecked, isFeasible) { this.executeDelegate = executeDelegate; this.requiredPermission = requiredPermission; this.securityDomainName = securityDomainName; Debug.Assert(PermissionsAreValid()); }
//??? Enabled = false для Parent у MeshInSpace? Тогда Select вынести из Execute. public static void ExecuteAction(ActionContext actionContext, ActionExecuteDelegate execute) //, ActionCanExecuteDelegate canExecute ) { var ms = actionContext.GetSelectedMeshInSpaceArray(); if (ms.Length == 0) { return; } var undo = new UndoMultiAction(); bool needUndo = false; bool changed = false; foreach (var m in ms) { var mesh = m.Mesh.Value; if (mesh != null) { //??? Если несколько Mesh переобразовалось и несколоько не изменились, сейчас обрабатывается так - undo не нужен только если все преобразовались. CommonFunctions.CopyExternalMesh(actionContext.DocumentWindow.Document, m, ref mesh, undo, out var needUndoForNextActions); //make copy of the mesh if needed if (needUndoForNextActions) { needUndo = true; } else { changed = true; } } } foreach (var m in ms) { if (!CheckValidMeshWithMessageBox(m.Mesh)) { if (changed) { actionContext.DocumentWindow?.Document?.CommitUndoAction(undo); } return; } } execute(ms, needUndo ? undo : null, undo); undo.Actions.Reverse(); actionContext.DocumentWindow?.Document?.CommitUndoAction(undo); }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, Color transparentColor, string name, string description, bool isChecked, bool isFeasible, Permission requiredPermission, IEnumerable <Shape> shapes, ActionExecuteDelegate executeDelegate) : this(title, image, transparentColor, name, description, isChecked, isFeasible, requiredPermission, ConvertEnumerator <ISecurityDomainObject> .Create(shapes), NoSecurityDomain, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, string name, string description, bool isChecked, bool isFeasible, Permission requiredPermission, ActionExecuteDelegate executeDelegate) : this(title, image, Color.Empty, name, description, isChecked, isFeasible, requiredPermission, null, NoSecurityDomain, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, IEnumerable <Shape> shapes, ActionExecuteDelegate executeDelegate) : this(title, image, Color.Empty, string.Format("{0} Action", title), description, false, isFeasible, requiredPermission, ConvertEnumerator <ISecurityDomainObject> .Create(shapes), NoSecurityDomain, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> protected DelegateMenuItemDef(string title, Bitmap image, Color transparentColor, string name, string description, bool isChecked, bool isFeasible, Permission requiredPermission, char securityDomainName, ActionExecuteDelegate executeDelegate) : base(title, image, transparentColor, name, description, isChecked, isFeasible) { this.executeDelegate = executeDelegate; this.requiredPermission = requiredPermission; this.securityDomainName = securityDomainName; Debug.Assert(PermissionsAreValid()); }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, Color transparentColor, string name, string description, bool isChecked, bool isFeasible, Permission requiredPermission, ActionExecuteDelegate executeDelegate) : this(title, image, transparentColor, name, description, isChecked, isFeasible, requiredPermission, null, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, char securityDomainName, ActionExecuteDelegate executeDelegate) : this(title, image, Color.Empty, string.Format("{0} Action", title), description, false, isFeasible, requiredPermission, securityDomainName, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, IEnumerable<Shape> shapes, ActionExecuteDelegate executeDelegate) : this(title, image, Color.Empty, string.Format("{0} Action", title), description, false, isFeasible, requiredPermission, shapes, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string name, string title, Bitmap image, Color transparentColor, string description, bool isChecked, bool isFeasible, Permission requiredPermission, IEnumerable <ISecurityDomainObject> objects, ActionExecuteDelegate executeDelegate) : this(name, title, image, transparentColor, description, isChecked, isFeasible, requiredPermission, objects, NoSecurityDomain, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string name, string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, char securityDomainName, ActionExecuteDelegate executeDelegate) : this(name, title, image, Color.Empty, description, false, isFeasible, requiredPermission, null, securityDomainName, executeDelegate) { }
public DelegateMenuItemDef(string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, IEnumerable <ISecurityDomainObject> objects, ActionExecuteDelegate executeDelegate) : this(string.Format("{0} Action", title), title, image, Color.Empty, description, false, isFeasible, requiredPermission, objects, NoSecurityDomain, executeDelegate) { }
/// <ToBeCompleted></ToBeCompleted> public DelegateMenuItemDef(string title, Bitmap image, string description, bool isFeasible, Permission requiredPermission, char securityDomainName, ActionExecuteDelegate executeDelegate) : this(title, image, Color.Empty, string.Format("{0} Action", title), description, false, isFeasible, requiredPermission, executeDelegate) { this.securityDomainName = securityDomainName; }
/// <summary> /// Initializes the action by populating it with delegates representing the methods that will handle Execute and Update methods of the action. /// </summary> /// <param name="delegateExecute">A delegate for the method that will handle the action execution.</param> /// <param name="delegateUpdate">A delegate for the method that will handle the action update.</param> /// <remarks> /// <para>You may supply <c>Null</c> in place of one or more delegates if you wish the action to do nothing in response to the corresponding event.</para> /// </remarks> public MethodInvokerAction(ActionExecuteDelegate delegateExecute, ActionUpdateDelegate delegateUpdate) { _delegateExecute = delegateExecute; _delegateUpdate = delegateUpdate; }