private void OtherRadio_Checked(object sender, RoutedEventArgs e) { WF.FolderBrowserDialog fb = new WF.FolderBrowserDialog(); WF.DialogResult result = fb.ShowDialog(); if (result == WF.DialogResult.Cancel) { return; } if (this.fileList.HasItems) { this.fileList.Items.Clear(); } string m_Dir = fb.SelectedPath.Trim(); this._delDirectory = m_Dir; List <string> names = ExternalFuncs.GetFileNames(m_Dir); foreach (var item in names) { ListViewItem i = new ListViewItem { Content = item }; this.fileList.Items.Add(i); } }
private void DeleteBtn_Click(object sender, RoutedEventArgs e) { if (!this.fileList.HasItems) { TaskDialog.Show("警告", "恭喜你!当前路径不存在备份文件~"); return; } foreach (var name in ExternalFuncs.GetFileNames(this._delDirectory)) { string filePath = System.IO.Path.Combine(this._delDirectory, name); System.IO.File.Delete(filePath); } this.fileList.Items.Clear(); TaskDialog.Show("提示", "备份文件已删除!"); }
private void CurrentRadio_Checked(object sender, RoutedEventArgs e) { this._delDirectory = this._currentDirectory; if (this.fileList.HasItems) { this.fileList.Items.Clear(); } foreach (var item in ExternalFuncs.GetFileNames(this._currentDirectory)) { ListViewItem i = new ListViewItem { Content = item }; this.fileList.Items.Add(i); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { var doc = commandData.Application.ActiveUIDocument.Document; var currentPath = doc.PathName; if (currentPath == "") { TaskDialog.Show("警告", "当前文件并未保存!"); return(Result.Failed); } string docPath = Path.GetDirectoryName(currentPath); List <string> names = ExternalFuncs.GetFileNames(docPath); DelBackupUI mainWindow = new DelBackupUI(names, docPath); mainWindow.ShowDialog(); return(Result.Succeeded); }