Ejemplo n.º 1
0
 /// <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)
 {
 }
Ejemplo n.º 2
0
 /// <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)
 {
 }
Ejemplo n.º 3
0
 /// <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());
 }
Ejemplo n.º 4
0
        //??? 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);
        }
Ejemplo n.º 5
0
 /// <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)
 {
 }
Ejemplo n.º 6
0
 /// <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)
 {
 }
Ejemplo n.º 7
0
 /// <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)
 {
 }
Ejemplo n.º 8
0
 /// <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());
 }
Ejemplo n.º 9
0
 /// <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)
 {
 }
Ejemplo n.º 10
0
 /// <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)
 {
 }
Ejemplo n.º 11
0
 /// <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)
 {
 }
Ejemplo n.º 12
0
 /// <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)
 {
 }
Ejemplo n.º 13
0
 /// <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)
 {
 }
Ejemplo n.º 14
0
 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)
 {
 }
Ejemplo n.º 15
0
 /// <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;
 }
Ejemplo n.º 16
0
 /// <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;
 }