示例#1
0
        protected override bool NeedProcess(IResourceList selectedResources)
        {
            if (selectedResources.Count == 0)
            {
                return(false);
            }
            string strConfirmation = null;
            bool   deletedItems    = _deletedItems;

            if (deletedItems)
            {
                bool change     = true;
                bool hasDeleted = false;
                foreach (IResource resource in selectedResources.ValidResources)
                {
                    if (!Folder.HasDeletedItemsAsAncestor(resource))
                    {
                        change = false;
                        break;
                    }
                    else
                    {
                        hasDeleted = true;
                    }
                }
                if (change && hasDeleted)
                {
                    deletedItems = false;
                }
            }
            if (deletedItems)
            {
                if (selectedResources.Count > 1)
                {
                    strConfirmation =
                        "Are you sure you want to delete the selected folders and move all of their contents into the Deleted Items folder?";
                }
                else
                {
                    string folderName = selectedResources[0].GetPropText(Core.Props.Name);
                    strConfirmation =
                        "Are you sure you want to delete the folder '"
                        + folderName + "' and move all of its contents into the Deleted Items folder?";
                }
            }
            else
            {
                if (selectedResources.Count > 1)
                {
                    strConfirmation =
                        "Are you sure that you want to permanently delete the selected folders?";
                }
                else
                {
                    strConfirmation =
                        "Are you sure that you want to permanently delete the selected folder?";
                }
            }
            DialogResult result =
                MessageBox.Show(strConfirmation, "Attention", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            return(result == DialogResult.Yes);
        }