/// <summary> /// Creates a new <see cref="FileSystemControl" />. /// </summary> public FileSystemControl() : base() { m_controller = new FileSystemController(); m_controller.SelectDirectory(CurrentDirectory); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.OpenSpecialDirectoriesDrawerCommand, OpenSpecialDirectoriesDrawerCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.SwitchPathPartsAsButtonsCommand, SwitchPathPartsAsButtonsHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.SelectDirectoryItemCommand, SelectDirectoryItemCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.SelectFileSystemEntryCommand, SelectFileSystemEntryCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.ShowInfoCommand, ShowInfoCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.CancelCommand, CancelCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.ShowCreateNewDirectoryCommand, ShowCreateNewDirectoryCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.CancelNewDirectoryCommand, CancelNewDirectoryCommandHandler)); CommandBindings.Add(new CommandBinding(FileSystemControlCommands.CreateNewDirectoryCommand, CreateNewDirectoryCommandHandler)); InputBindings.Add(new KeyBinding(FileSystemControlCommands.CancelCommand, new KeyGesture(Key.Escape))); m_pathPartsScrollViewer = null; m_pathPartsItemsControl = null; m_currentDirectoryTextBox = null; m_fileSystemEntryItemsScrollViewer = null; m_fileSystemEntryItemsControl = null; Loaded += LoadedHandler; Unloaded += UnloadedHandler; }
protected virtual void CurrentDirectoryChangedHandler(string newCurrentDirectory) { try { m_controller.SelectDirectory(newCurrentDirectory); } catch (Exception exc) when(exc is UnauthorizedAccessException || exc is FileNotFoundException) { SnackbarMessageQueue.Enqueue(exc.Message); } }
public void TestBuildFullFileNameForInCurrentDirectoryWithoutForcedFileExtension() { FileSystemController fileSystemController = new FileSystemController() { ForceFileExtensionOfFileFilter = false, FileFilterToApply = FileFilterHelper.ParseFileFilter("Test", "*.cs;*.xaml") }; fileSystemController.SelectDirectory(m_directory); string filename = fileSystemController.BuildFullFileNameForInCurrentDirectory("test.txt"); Assert.AreEqual($@"{m_directory}\test.txt", filename); }
protected virtual void CurrentDirectoryChangedHandler(string newCurrentDirectory) { try { m_controller.SelectDirectory(newCurrentDirectory); } catch (PathTooLongException) { SnackbarMessageQueue.Enqueue(Localization.Strings.LongPathsAreNotSupported); } catch (Exception exc) when(exc is UnauthorizedAccessException || exc is FileNotFoundException) { SnackbarMessageQueue.Enqueue(exc.Message); } }
public FileSystemControl() : base() { m_controller = new FileSystemController(); m_controller.SelectDirectory(CurrentDirectory); CommandBindings.Add(new CommandBinding(OpenSpecialDirectoriesDrawerCommand, OpenSpecialDirectoriesDrawerCommandHandler)); CommandBindings.Add(new CommandBinding(SelectDirectoryItemCommand, SelectDirectoryItemCommandHandler)); CommandBindings.Add(new CommandBinding(SelectFileSystemEntryCommand, SelectFileSystemEntryCommandHandler)); CommandBindings.Add(new CommandBinding(ShowInfoCommand, ShowInfoCommandHandler)); CommandBindings.Add(new CommandBinding(CancelCommand, CancelCommandHandler)); m_pathPartsScrollViewer = null; m_pathPartsItemsControl = null; m_fileSystemEntryItemsScrollViewer = null; m_fileSystemEntryItemsControl = null; Loaded += LoadedHandler; Unloaded += UnloadedHandler; }