コード例 #1
0
        /// <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;
        }
コード例 #2
0
 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);
         }
 }
コード例 #3
0
        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);
        }
コード例 #4
0
 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);
         }
 }
コード例 #5
0
        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;
        }