示例#1
0
        public static void Move(Session session, IXenObject ixmo, Folder target)
        {
            if (ixmo == null || target == null)
            {
                return;
            }

            // First check we're not moving parent -> child
            if (target.IsChildOf(ixmo))
            {
                return;
            }

            // Then check the object is not already in the folder
            for (int i = 0; i < target.XenObjects.Length; i++)
            {
                if (target.XenObjects[i].opaque_ref == ixmo.opaque_ref)
                {
                    return;
                }
            }

            FolderAction action = new FolderAction(ixmo, target, FolderAction.Kind.Move);

            if (session == null)
            {
                action.RunAsync();
            }
            else
            {
                action.RunExternal(session);
            }
        }
示例#2
0
        public static void Unfolder(Session session, IXenObject ixmo)
        {
            if (ixmo == null)
            {
                return;
            }

            FolderAction action = new FolderAction(ixmo, null, FolderAction.Kind.Delete);

            if (session == null)
            {
                action.RunAsync();
            }
            else
            {
                action.RunExternal(session);
            }
        }