Beispiel #1
0
 public MethodDragDropOperation(MethodInfo mtd, DragDropOperationAttribute attr, object baseObject, IEnumerable <AppObject> objs)
 {
     m_mtd        = mtd;
     m_attr       = attr;
     m_baseObject = baseObject;
     Args.AddRange(objs);
 }
Beispiel #2
0
 private void ProcessOperation(object baseObject, AppObject[] draggedObjs, MethodInfo mtd, DragDropOperationAttribute attr)
 {
     if (!LicenseTool.FeatureAllowed(attr.RequiredFeature))
     {
         return;
     }
     if (attr.MultiMode == MultipleMode.NativeMulti)
     {
         var okobjs = new List <AppObject>(draggedObjs);
         foreach (MethodInfo vmtd in baseObject.GetType().GetMethods())
         {
             foreach (DragDropOperationFilterMultiAttribute fattr in vmtd.GetCustomAttributes(typeof(DragDropOperationFilterMultiAttribute), true))
             {
                 if (fattr.Name == attr.Name)
                 {
                     vmtd.Invoke(baseObject, new object[] { okobjs });
                 }
             }
         }
         var op = new MethodDragDropOperation(mtd, attr, baseObject, okobjs);
         if (op.Acceptable())
         {
             Operations.Add(op);
         }
         return;
     }
     else
     {
         var okobjs = new List <AppObject>(draggedObjs);
         foreach (MethodInfo vmtd in baseObject.GetType().GetMethods())
         {
             foreach (DragDropOperationVisibleAttribute vattr in vmtd.GetCustomAttributes(typeof(DragDropOperationVisibleAttribute), true))
             {
                 if (vattr.Name == attr.Name)
                 {
                     okobjs.Clear();
                     foreach (var appobj in draggedObjs)
                     {
                         if ((bool)vmtd.Invoke(baseObject, new object[] { appobj }))
                         {
                             okobjs.Add(appobj);
                         }
                     }
                 }
             }
         }
         var op = new MethodDragDropOperation(mtd, attr, baseObject, okobjs);
         if (op.Acceptable())
         {
             Operations.Add(op);
         }
         return;
     }
 }