public IExplorerViewModel OpenTab(IEntryModel model = null) { var initializer = _initializer.Clone(); if (initializer is ExplorerInitializer) { ExplorerInitializer eInit = initializer as ExplorerInitializer; if (model != null) { eInit.Initializers.Add(ExplorerInitializers.StartupDirectory(model)); } } else if (initializer is ScriptCommandInitializer) { ScriptCommandInitializer sInit = initializer as ScriptCommandInitializer; sInit.OnViewAttached = (model != null) ? ScriptCommands.Assign("{StartupPath}", model.FullPath, false, UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot()) : UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot(); sInit.OnModelCreated = ScriptCommands.Assign("{TabbedExplorer}", this, false, UIScriptCommands.ExplorerAssignScriptParameters("{Explorer}", "{TabbedExplorer}", sInit.OnModelCreated)); } ExplorerViewModel expvm = new ExplorerViewModel(_windowManager, _events) { Initializer = initializer }; //expvm.Commands.ParameterDicConverter.AddAdditionalParameters(new ParameterDic() // { // {"TabbedExplorer", this } // }); expvm.DropHelper = new TabDropHelper <IExplorerViewModel>(expvm, this); //expvm.FileList.Commands.CommandDictionary.CloseTab = // UIScriptCommands.TabExplorerCloseTab("{TabbedExplorer}", "{Explorer}"); ////ScriptCommands.ReassignToParameter("{Explorer}", TabbedExplorer.CloseTab(this)); expvm.FileList.Commands.CommandDictionary.OpenTab = ScriptCommands.Assign("{TabbedExplorer}", this, false, FileList.AssignSelectionToParameter( UIScriptCommands.TabExplorerNewTab("{TabbedExplorer}", "{Parameter}", null))); expvm.DirectoryTree.Commands.CommandDictionary.OpenTab = ScriptCommands.Assign("{TabbedExplorer}", this, false, DirectoryTree.AssignSelectionToParameter( UIScriptCommands.TabExplorerNewTab("{TabbedExplorer}", "{Parameter}", null))); ActivateItem(expvm); checkTabs(); return(expvm); }
protected ExplorerInitializer(ExplorerInitializer initializer) : this(initializer.WindowManager, initializer.Events, initializer.RootModels, initializer.Initializers.ToArray()) { }