/// <summary> /// Serializable, refresh and select the specified entries (IEnumerable or IEntryModel[]) in the filelist. /// </summary> /// <param name="fileListVariable"></param> /// <param name="entriesVariable"></param> /// <param name="force"></param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand FileListRefreshThenSelect(string fileListVariable = "{FileList}", string entriesVariable = "{Entries}", bool force = false, IScriptCommand nextCommand = null) { return(UIScriptCommands.FileListRefresh(force, FileListSelect(fileListVariable, entriesVariable, nextCommand))); }
public static IScriptCommand FileListIfSelectionLength(string fileListVariable = "{FileList}", ComparsionOperator op = ComparsionOperator.Equals, int value = 1, IScriptCommand thenCommand = null, IScriptCommand otherwiseCommand = null) { string fileListSelectionVariable = ParameterDic.CombineVariable(fileListVariable, "Selection"); return(UIScriptCommands.FileListAssignSelection(fileListSelectionVariable, ScriptCommands.IfArrayLength(op, fileListSelectionVariable, value, thenCommand, otherwiseCommand))); }
public override IScriptCommand Execute(ParameterDic pm) { return(ScriptCommands.Assign(new Dictionary <string, object>() { { "{ColumnList}", IOInitializeHelpers.FileList_ColumList_For_DiskBased_Items }, { "{ColumnFilters}", IOInitializeHelpers.FileList_ColumnFilter_For_DiskBased_Items }, { "{FileListOpenCommand}", IOInitializeHelpers.FileList_Open_For_DiskBased_Items }, { "{FileListDeleteCommand}", IOInitializeHelpers.FileList_Delete }, { "{FileListNewFolderCommand}", IOInitializeHelpers.FileList_NewFolder }, { "{FileListCutCommand}", IOInitializeHelpers.FileList_Cut_For_DiskBased_Items }, { "{FileListCopyCommand}", IOInitializeHelpers.FileList_Copy_For_DiskBased_Items }, { "{FileListPasteCommand}", IOInitializeHelpers.FileList_Paste_For_DiskBased_Items }, { "{FileListNewWindowCommand}", IOInitializeHelpers.FileList_NewWindow }, { "{DirectoryTreeMapCommand}", IOInitializeHelpers.DirectoryTree_Map_From_Profiles }, { "{DirectoryTreeUnmapCommand}", IOInitializeHelpers.DirectoryTree_Unmap }, { "{DirectoryTreeNewWindowCommand}", IOInitializeHelpers.DirectoryTree_NewWindow }, }, true, ScriptCommands.RunSequence(NextCommand, UIScriptCommands.ExplorerAssignScriptParameters(ExplorerKey, "{Profiles}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.RootModels, "{RootDirectories}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.FileName, "{FileName}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.EnableContextMenu, "{EnableContextMenu}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.EnableDrag, "{EnableDrag}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.EnableDrop, "{EnableDrop}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.EnableMultiSelect, "{EnableMultiSelect}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ColumnList, "{ColumnList}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ColumnFilters, "{ColumnFilters}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.FilterString, "{FilterString}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ViewMode, "{ViewMode}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ItemSize, "{ItemSize}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ShowToolbar, "{ShowToolbar}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ShowSidebar, "{ShowSidebar}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ShowGridHeader, "{ShowGridHeader}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ExplorerWidth, "{ExplorerWidth}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ExplorerHeight, "{ExplorerHeight}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.ExplorerPosition, "{ExplorerPosition}"), UIScriptCommands.ExplorerSetParameter(ExplorerKey, ExplorerParameterType.EnableBookmark, "{EnableBookmark}"), UIScriptCommands.SetScriptCommand(FileListKey, "Open", "{FileListOpenCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "Delete", "{FileListDeleteCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "NewFolder", "{FileListNewFolderCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "OpenTab", "{FileListOpenTabCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "Cut", "{FileListCutCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "Copy", "{FileListCopyCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "Paste", "{FileListPasteCommand}"), UIScriptCommands.SetScriptCommand(FileListKey, "NewWindow", "{FileListNewWindowCommand}"), UIScriptCommands.SetScriptCommand(DirectoryTreeKey, "OpenTab", "{DirectoryTreeOpenTabCommand}"), UIScriptCommands.SetScriptCommand(DirectoryTreeKey, "NewWindow", "{DirectoryTreeNewWindowCommand}"), UIScriptCommands.SetScriptCommand(DirectoryTreeKey, "Map", "{DirectoryTreeMapCommand}"), UIScriptCommands.SetScriptCommand(DirectoryTreeKey, "Unmap", "{DirectoryTreeUnmapCommand}") ) )); }
public static IScriptCommand ExplorerNewWindow(IProfile[] profiles, IEntryModel[] rootDirectories, string explorerVariable = "{Explorer}", IScriptCommand nextCommand = null) { return(ScriptCommands.Assign(new Dictionary <string, object>() { { "{Profiles}", profiles }, { "{RootDirectories}", rootDirectories }, { "{OnModelCreated}", IOInitializeHelpers.Explorer_Initialize_Default }, { "{OnViewAttached}", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() } }, false, UIScriptCommands.ExplorerNewWindow("{OnModelCreated}", "{OnViewAttached}", "{WindowManager}", "{GlobalEvents}", explorerVariable, nextCommand))); }
/// <summary> /// Serializable, Create a new directory or file picker explorer window (IExplorerViewModel), and show it. /// </summary> /// <param name="mode"></param> /// <param name="onModelCreatedVariable"></param> /// <param name="onViewAttachedVariable"></param> /// <param name="windowManagerVariable"></param> /// <param name="eventAggregatorVariable"></param> /// <param name="selectionVariable"></param> /// <param name="selectionPathsVariable"></param> /// <param name="nextCommand"></param> /// <param name="cancelCommand"></param> /// <returns></returns> public static IScriptCommand ExplorerPick(ExplorerMode mode = ExplorerMode.FileSave, string onModelCreatedVariable = "{OnModelCreated}", string onViewAttachedVariable = "{OnViewAttached}", string windowManagerVariable = "{WindowManager}", string eventAggregatorVariable = "{GlobalEvents}", string selectionVariable = null, string selectionPathsVariable = "{SelectionPaths}", IScriptCommand nextCommand = null, IScriptCommand cancelCommand = null) { string dialogResultVariable = "{ExplorerPick-DialogResult}"; string explorerVariable = "{ExplorerPick-Explorer}"; return(ExplorerCreate(mode, onModelCreatedVariable, onViewAttachedVariable, windowManagerVariable, eventAggregatorVariable, explorerVariable, UIScriptCommands.explorerShow(windowManagerVariable, explorerVariable, dialogResultVariable, selectionVariable, selectionPathsVariable, ScriptCommands.IfTrue(dialogResultVariable, nextCommand, cancelCommand)))); }
public static IScriptCommand FileSave( string filterString = "All files (*.*)|*.*", string selectionPathsVariable = "{Selection}", IScriptCommand nextCommand = null, IScriptCommand cancelCommand = null) { return(ScriptCommands.Assign(new Dictionary <string, object>() { { "{EnableDrag}", false }, { "{EnableDrop}", false }, { "{FilterString}", filterString }, { "{EnableMultiSelect}", false }, { "{FileListNewWindowCommand}", NullScriptCommand.Instance }, { "{OnModelCreated}", IOInitializeHelpers.Explorer_Initialize_Default }, { "{OnViewAttached}", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() } }, false, UIScriptCommands.ExplorerPick(ExplorerMode.FileSave, "{OnModelCreated}", "{OnViewAttached}", "{WindowManager}", "{GlobalEvents}", null, selectionPathsVariable, nextCommand, cancelCommand))); }
public static IScriptCommand DirectoryPick(IProfile[] profiles, IEntryModel[] rootDirectories, string selectionVariable = "{Selection}", string selectionPathVariable = "{SelectionPaths}", IScriptCommand nextCommand = null, IScriptCommand cancelCommand = null) { return(ScriptCommands.Assign(new Dictionary <string, object>() { { "{Profiles}", profiles }, { "{RootDirectories}", rootDirectories }, { "{EnableDrag}", false }, { "{EnableDrop}", false }, { "{EnableMultiSelect}", false }, { "{FileListNewWindowCommand}", NullScriptCommand.Instance }, { "{OnModelCreated}", IOInitializeHelpers.Explorer_Initialize_Default }, { "{OnViewAttached}", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() } }, false, UIScriptCommands.ExplorerPick(ExplorerMode.DirectoryOpen, "{OnModelCreated}", "{OnViewAttached}", "{WindowManager}", "{GlobalEvents}", selectionVariable, selectionPathVariable, nextCommand, cancelCommand))); }
public override IScriptCommand Execute(ParameterDic pm) { IWindowManager windowManager = pm.GetValue <IWindowManager>(WindowManagerKey) ?? new WindowManager(); return(UIScriptCommands.ExplorerDo(ExplorerKey, explorerModel => { #region FileList explorerModel.FileList.Commands.ToolbarCommands.ExtraCommandProviders = new[] { new StaticCommandProvider( new SeparatorCommandModel(), new SelectGroupCommand(explorerModel.FileList), new ViewModeCommand(explorerModel.FileList), new SeparatorCommandModel(), new CommandModel(ExplorerCommands.NewFolder) { IsVisibleOnToolbar = true, HeaderIconExtractor = ResourceIconExtractor <ICommandModel> .ForSymbol(0xE188) //Symbol = Convert.ToChar(0xE188) }, new DirectoryCommandModel( new CommandModel(ExplorerCommands.NewFolder) { Header = Strings.strFolder, IsVisibleOnMenu = true } ) { IsVisibleOnMenu = true, Header = Strings.strNew, IsEnabled = true }, new ToggleVisibilityCommand(explorerModel.FileList.Sidebar, ExplorerCommands.TogglePreviewer) //new CommandModel(ExplorerCommands.TogglePreviewer) { IsVisibleOnMenu = false, Header = "", IsHeaderAlignRight = true, Symbol = Convert.ToChar(0xE239) } ) }; #endregion #region DirectoryTree explorerModel.DirectoryTree.Commands.ToolbarCommands.ExtraCommandProviders = new[] { new StaticCommandProvider( new DirectoryCommandModel( new CommandModel(ExplorerCommands.NewWindow) { IsVisibleOnMenu = true }, new CommandModel(ExplorerCommands.OpenTab) { IsVisibleOnMenu = true }) { Header = "Open", IsVisibleOnMenu = true, IsEnabled = true }, //new CommandModel(ApplicationCommands.New) { IsVisibleOnMenu = true }, new CommandModel(ExplorerCommands.Refresh) { IsVisibleOnMenu = true }, new CommandModel(ApplicationCommands.Delete) { IsVisibleOnMenu = true }, new CommandModel(ExplorerCommands.Rename) { IsVisibleOnMenu = true }, new CommandModel(ExplorerCommands.Map) { //Symbol = Convert.ToChar(0xE17B), HeaderIconExtractor = ResourceIconExtractor <ICommandModel> .ForSymbol(0xE17B), IsEnabled = true, IsHeaderVisible = false, IsVisibleOnToolbar = true }, new CommandModel(ExplorerCommands.Unmap) { HeaderIconExtractor = ResourceIconExtractor <ICommandModel> .ForSymbol(0xE17A), IsVisibleOnMenu = true, IsVisibleOnToolbar = true } ) }; #endregion } , NextCommand)); }
/// <summary> /// Serializable, If {StartupPath} is defined, goto the path, otherwise go to first root directory and expand it. /// Used to initialize Explorer onViewAttached. /// </summary> /// <param name="explorerVariable"></param> /// <param name="profilesVariable"></param> /// <param name="rootDirectoriesVariable"></param> /// <param name="startupPathVariable"></param> /// <param name="nextCommand"></param> /// <returns></returns> public static IScriptCommand ExplorerGotoStartupPathOrFirstRoot(string explorerVariable = "{Explorer}", string profilesVariable = "{Profiles}", string rootDirectoriesVariable = "{RootDirectories}", string startupPathVariable = "{StartupPath}", IScriptCommand nextCommand = null) { string firstRootDirectoriesVariable = ParameterDic.CombineVariable(rootDirectoriesVariable, "[0]"); return (ScriptCommands.RunSequence(nextCommand, ScriptCommands.IfAssignedAndNotEmptyString(startupPathVariable, UIScriptCommands.ExplorerParseAndGoTo(explorerVariable, profilesVariable, startupPathVariable), UIScriptCommands.ExplorerGoTo(explorerVariable, firstRootDirectoriesVariable, UIScriptCommands.DirectoryTreeToggleExpand(firstRootDirectoriesVariable))))); }