Esempio n. 1
0
        public bool DoDelete(bool alert)
        {
            if (!this.CanDelete)
            {
                return(false);
            }

            if (alert)
            {
                if (MessageBox.Show(Resource.DeleteItemMsg, Resource.DefaultDlgTitle, MessageBoxButton.OKCancel, MessageBoxImage.Asterisk) != MessageBoxResult.OK)
                {
                    return(false);
                }
            }

            if (!(this.Parent as ViFolderInfo).RemoveChild(this))
            {
                return(false);
            }
            // 如果文件已经存在,则将文件删除到回收站;
            if (File.Exists(this.FullName))
            {
                return(FileName.DeleteToRecycleBin(this.FullName));
            }

            return(false);
        }