Just What I Needed

Feb 18, 2014 at 7:11 PM
Thanks for writing this awesome application.

This is the Yin to my Yang. I was looking for an application that would let me add custom actions and create folder names longer than 255 characters such as is found in Windows, and this looks like it will do the trick.

You're using the latest technology; too, which is impressive. I would've preferred the MVVMLight framework over Calibre; but, it's still all good.

Thank you, again.
Feb 20, 2014 at 5:44 AM

Glad you like this component.

FileExplorer3 do allow you to add custom actions and define custom behaviour when user do actions like double click on an item, you can update the ExtraCommandProvider properties to supply custom actions in toolbar and context menu, e.g.
      _explorer.FileList.Commands.ToolbarCommands.ExtraCommandProviders = new[] { 
            new StaticCommandProvider(
                    new CommandModel(ApplicationCommands.Open) { IsVisibleOnToolbar = false },
                    new GoogleExportCommandModel(() => _rootModels.ToArray()) { IsVisibleOnToolbar = false, ... } //I am doing GoogleDrive support right now
The first one uses ApplicationCommands, although I op to use Calibre, but I uses it mainly for WindowManager and EventAggregator only, I still have register a number of ApplicationCommands which you can use in other MVVM framework, they are registered in FileListCommandManager:
            new ExportCommandBindings(
                ScriptCommandBinding.FromScriptCommand(ApplicationCommands.Open, this, (ch) => ch.ScriptCommands.Open, 
                ParameterDicConverter, ScriptBindingScope.Local), ...
Then these binding are registered to ui in FileList/ExplorerViewModel's OnViewAttached() method, which is defined by Calibre to retrieve view of the specific view model.

You can change the Open action by setting the Open property (e.g. (ch) => ch.ScriptCommands.Open from the above sample)
    _explorer.FileList.Commands.ScriptCommands.Open =
          FileList.IfSelection(evm => evm.Count() == 1,
              FileList.IfSelection(evm => evm[0].EntryModel.IsDirectory,
                  FileList.OpenSelectedDirectory, //Selected directory                        
                      new OpenWithScriptCommand(null))),  //Selected non-directory
              ResultCommand.NoError //Selected more than one item, ignore.
The property is in IScriptCommand property, which have it's executable code in its Execute()/ExecuteAsync() method, and return another IScriptCommand when finished.

Regarding create new folder, it's possible to attach a command to create new folder using the previous mentioned ExtraCommandProviders, but currently FileListViewModel missed script command for setting selected items, I will take a look how to write this afterwards.

Joseph Leung
Feb 22, 2014 at 6:17 PM

Thank you for that insight. It looks like you spent a good deal of time developing your own comand-framework for this project.

I'll look into the above code and see how it operates, because I know there are indeed, custom Actions I will wish to take to accomplish my objectives.

Again, thank you.

Robert Hyland
Feb 23, 2014 at 8:28 AM

NewFolder command (ExplorerCommands.NewFolder) is now available:
    _explorer.FileList.Commands.ScriptCommands.NewFolder =
            FileList.Do(flvm => ScriptCommands.CreatePath(
                    flvm.CurrentDirectory, "NewFolder", true, true,
                    m => FileList.Refresh(FileList.Select(fm => fm.Equals(m), ResultCommand.OK), true)));
.... and added the command in Toolbar and ContextMenu:
  new CommandModel(ExplorerCommands.NewFolder) { IsVisibleOnMenu = false, Symbol = Convert.ToChar(0xE188) },
                new DirectoryCommandModel(new CommandModel(ExplorerCommands.NewFolder) { Header = Strings.strFolder })
                    { IsVisibleOnToolbar = false, Header = Strings.strNew, IsEnabled = true}
Joseph Leung