예제 #1
0
        public DragDropEffects DragOver(IResource targetResource, IDataObject data, DragDropEffects allowedEffect, int keyState)
        {
            if (data.GetDataPresent(typeof(IResourceList)))                // Dragging resources over
            {
                // The resources we're dragging
                IResourceList dragResources = (IResourceList)data.GetData(typeof(IResourceList));

                if (ListOfMailsOrLinkedAttachments(dragResources))
                {
                    return(DragDropEffects.Move);
                }
                if (!dragResources.AllResourcesOfType(STR.MAPIFolder))
                {
                    return(DragDropEffects.None);
                }
                foreach (IResource folder in dragResources.ValidResources)
                {
                    //  A default folder cannot be moved, so it can be dropped
                    //  only to its own parent for the sake of reordering
                    if ((Folder.IsDefault(folder)) && (Folder.GetParent(folder) != targetResource))
                    {
                        return(DragDropEffects.None);
                    }

                    // Don't allow dropping to self and own children
                    if ((folder == targetResource) || (Folder.IsAncestor(targetResource, folder)))
                    {
                        return(DragDropEffects.None);
                    }
                }
                return(DragDropEffects.Move);
            }
            return(DragDropEffects.None);
        }
예제 #2
0
 protected override void ExecuteActionImpl(IResourceList selectedResources)
 {
     foreach (IResource folder in selectedResources.ValidResources)
     {
         if (folder.Id == _lastFolder.Id || Folder.IsDefault(folder) || Folder.IsAncestor(_lastFolder, folder))
         {
             StandartJobs.MessageBox("Cannot move folder '" + folder.DisplayName +
                                     "' to folder '" + _lastFolder.DisplayName + "'", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
     }
     new MoveFolderToFolderAction().DoMove(_lastFolder, selectedResources);
 }