private void DirectoriesField_MouseDoubleClick(object sender, MouseButtonEventArgs e) { PreviousPath = _currentChosenPath; var fileObject = DirectoriesField.SelectedItem; if (fileObject.GetType() == typeof(FileModel)) { FIleObject file = (FIleObject)fileObject; Process.Start(file.FullPath); } else { FolderModel folder = (FolderModel)fileObject; this._currentChosenPath = folder.FullPath; RefreshDirectoriesField(_currentChosenPath); } }
public void DeleteFileObject(FIleObject fIleObject) { var type = fIleObject.GetType(); try { if (type == typeof(FileModel)) { var file = new FileInfo(fIleObject.FullPath); file.Delete();/// todo next } else if ((type == typeof(FolderModel))) { var folder = new DirectoryInfo(fIleObject.FullPath); folder.Delete(true); } } catch (Exception) { throw; } }