コード例 #1
0
        private void OnDeleteFiles(object parameter)
        {
            DeleteFileDialog delete = new DeleteFileDialog();

            delete.ShowDialog();
            DialogResult result = delete.DialogResult;

            switch (result)
            {
            case DialogResult.No:
                return;

            case DialogResult.Cancel:
                return;
            }
            List <FileItem> files = new List <FileItem>();

            foreach (FileItem item in fileList.SelectedItems)
            {
                if (!string.IsNullOrEmpty(SubFolder))
                {
                    string pathString = System.IO.Path.Combine(installedLocation, SubFolder.ToString());
                    if (File.Exists(pathString + "/" + item.Name + ".xml"))
                    {
                        File.Delete(pathString + "/" + item.Name + ".xml");
                    }

                    files.Add(item);
                }
            }
            foreach (FileItem item in files)
            {
                (fileList.DataContext as ObservableCollection <FileItem>).Remove(item);
            }
        }
コード例 #2
0
        private static void OnDialogResultChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DeleteFileDialog dialog = d as DeleteFileDialog;

            if (dialog.DialogResultChanged != null)
            {
                dialog.DialogResultChanged.Invoke(dialog, null);
            }
        }