Beispiel #1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            //FileExplorer.WPF.UserControls.Explorer exp = explorer as FileExplorer.WPF.UserControls.Explorer;

            explorer.ViewModel.Initializer =
                new ScriptCommandInitializer()
            {
                OnModelCreated    = IOInitializeHelpers.Explorer_Initialize_Default,
                OnViewAttached    = UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot(),
                RootModels        = _rootDirs,
                StartupParameters = new ParameterDic()
                {
                    { "Profiles", _profiles },
                    { "RootDirectories", _rootDirs },
                    { "StartupPath", _selectedPath },
                    { "FilterString", _filterStr },
                    { "ViewMode", "List" },
                    { "ItemSize", 4 },
                    { "EnableDrag", true },
                    { "EnableDrop", true },
                    { "FileListNewWindowCommand", NullScriptCommand.Instance },     //Disable NewWindow Command.
                    { "EnableMultiSelect", true },
                    { "ShowToolbar", false },
                    { "ShowGridHeader", false }
                }
            };
            explorer.ViewModel.FileList.EnableContextMenu      = false;
            explorer.ViewModel.DirectoryTree.EnableContextMenu = false;
            explorer.ViewModel.FileList.PropertyChanged       += CurrentDirectory_PropertyChanged;
            //this.WatchSystem(explorer.ViewModel.CurrentDirectory.ToString());
        }
Beispiel #2
0
        public MdiWindow(IWindowManager wm, IEventAggregator events, IEntryModel[] rootModels)
        {
            InitializeComponent();

            _rootDirectories = rootModels;

            _initializer = new ScriptCommandInitializer()
            {
                WindowManager     = wm,
                Events            = events,
                OnModelCreated    = IOInitializeHelpers.Explorer_Initialize_Default,
                OnViewAttached    = UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot(),
                RootModels        = rootModels,
                StartupParameters = new ParameterDic()
                {
                    { "MdiWindow", this }
                }
            };

            //_initializer = AppViewModel.getInitializer(_windowManager, _events,  _root,
            //    new ColumnInitializers(),
            //    new ScriptCommandsInitializers(_windowManager, _events),
            //    new ToolbarCommandsInitializers(_windowManager));

            //_initializer.Initializers.Add(new MdiWindowInitializers(_initializer, Container));
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();


            cbExplorerMode.ItemsSource   = Enum.GetValues(typeof(FileExplorer.WPF.UserControls.Explorer.ExplorerMode));
            cbExplorerMode.SelectedValue = FileExplorer.WPF.UserControls.Explorer.ExplorerMode.ToolWindow;

            //For use in ToolWindow2 mode.
            //explorer.ViewModel.Parameters.NavigationSize = 25;
            //explorer.ViewModel.Parameters.DirectoryTreeSize = "2*";
            //explorer.ViewModel.Parameters.FileListSize = "*";

            explorer.ViewModel.Initializer =
                new ScriptCommandInitializer()
            {
                OnModelCreated    = IOInitializeHelpers.Explorer_Initialize_Default,
                OnViewAttached    = UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot(),
                RootModels        = _rootDirs,
                StartupParameters = new ParameterDic()
                {
                    { "Profiles", _profiles },
                    { "RootDirectories", _rootDirs },
                    { "StartupPath", _selectedPath },
                    { "FilterString", _filterStr },
                    { "ViewMode", "List" },
                    { "ItemSize", 16 },
                    { "EnableDrag", true },
                    { "EnableDrop", true },
                    { "FileListNewWindowCommand", NullScriptCommand.Instance },      //Disable NewWindow Command.
                    { "EnableMultiSelect", true },
                    { "ShowToolbar", false },
                    { "ShowGridHeader", false }
                }
            };
            testDroppable.DataContext = new TestDroppableViewModel();

            #region Obsoluted
            //exp.RootDirectories = _rootDirs;
            //exp.ViewModel.FileList.ShowToolbar = false;
            //exp.ViewModel.FileList.ShowGridHeader = false;
            //exp.ViewModel.FileList.Parameters.ViewMode = "List";
            //exp.ViewModel.FileList.Parameters.ItemSize = 16;
            //exp.ViewModel.FileList.EnableDrag = true;
            //exp.ViewModel.FileList.EnableDrop = false;
            //exp.ViewModel.FileList.EnableMultiSelect = false;
            //exp.ViewModel.FilterStr = _mask;


            //if (_selectedPath != null)
            //    exp.ViewModel.GoAsync(_selectedPath);

            //FileSystemInfoExProfile profile = new FileSystemInfoExProfile(exp.ViewModel.Events, exp.ViewModel.WindowManager);
            //var rootModel = AsyncUtils.RunSync(() => profile.ParseAsync(""));

            //or exp.ViewModel.Commands.ExecuteAsync(new IScriptCommand[] { Explorer.GoTo("C:\\") });
            #endregion
        }
        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);
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            var vm      = DataContext as AddBookmarksViewModel;
            var rootDir = new IEntryModel[] { vm.Profile.RootModel };

            expFolderPicker.ViewModel.Initializer =
                new ScriptCommandInitializer()
            {
                OnModelCreated = UIScriptCommands.ExplorerDefault(),
                OnViewAttached = ScriptCommands.Assign("{StartupDir}", vm.CurrentBookmarkDirectory, false,
                                                       ScriptCommands.Assign("{StartupPath}", "{StartupDir.FullPath}", false,
                                                                             UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot())),
                RootModels        = rootDir,
                StartupParameters = new ParameterDic()
                {
                    { "Profiles", vm.Profile },
                    { "RootDirectories", rootDir },
                    //{  "StartupPath", vm.CurrentBookmarkDirectory.FullPath },
                    //{ "StartupPath", _selectedPath },
                    //{ "FilterString", _filterStr },
                    { "ViewMode", "List" },
                    { "ItemSize", 16 },
                    { "EnableDrag", true },
                    { "EnableDrop", true },
                    { "EnableMap", false },
                    { "FileListNewWindowCommand", NullScriptCommand.Instance },      //Disable NewWindow Command.
                    { "EnableMultiSelect", true },
                    { "ShowToolbar", false },
                    { "ShowGridHeader", false }
                }
            };

            expFolderPicker.ViewModel.FileList.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrentDirectory")
                {
                    vm.CurrentBookmarkDirectory = expFolderPicker.ViewModel.FileList.CurrentDirectory;
                }
            };
            vm.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "CurrentBookmarkDirectory")
                {
                    expFolderPicker.ViewModel.FileList.CurrentDirectory = vm.CurrentBookmarkDirectory;
                }
            };
        }
 public static IScriptCommand ExplorerNewMdiWindow(WPF.MDI.MdiContainer container,
                                                   IProfile[] profiles, IEntryModel[] rootDirectories,
                                                   string explorerVariable = "{Explorer}", IScriptCommand nextCommand = null)
 {
     return(ScriptCommands.Assign(new Dictionary <string, object>()
     {
         { "{MdiContainer}", container },
         { "{Profiles}", profiles },
         { "{RootDirectories}", rootDirectories },
         { "{OnModelCreated}", ScriptCommands.RunSequence(null,
                                                          TestAppCommands.MdiExplorer_Initialize_Default,
                                                          UIScriptCommands.ExplorerAssignScriptParameters("{Explorer}", "{MdiContainer},{RootDirectories}")) },
         { "{OnViewAttached}", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() }
     }, false,
                                  TestAppCommands.ExplorerNewMdiWindow("{MdiContainer}", "{WindowManager}", "{GlobalEvents}", "{Explorer}", nextCommand)));
 }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            IEventAggregator _events        = new EventAggregator();
            IWindowManager   _windowManager = new AppWindowManager();
            IProfile         _exProfile     = new FileSystemInfoExProfile(_events, _windowManager);
            IProfile         _ioProfile     = new FileSystemInfoProfile(_events);

            IProfile[]    _profiles = new IProfile[] { _exProfile, _ioProfile };
            IEntryModel[] _rootDirs = new IEntryModel[] { AsyncUtils.RunSync(() => _exProfile.ParseAsync("")) };

            explorer.WindowManager         = _windowManager;
            explorer.ViewModel.Initializer =
                new ScriptCommandInitializer()
            {
                OnModelCreated    = ScriptCommands.Run("{OnModelCreated}"),
                OnViewAttached    = ScriptCommands.Run("{OnViewAttached}"),
                RootModels        = _rootDirs,
                WindowManager     = _windowManager,
                StartupParameters = new ParameterDic()
                {
                    { "Profiles", _profiles },
                    { "RootDirectories", _rootDirs },
                    { "GlobalEvents", _events },
                    { "WindowManager", _windowManager },
                    { "StartupPath", "" },
                    { "ViewMode", "List" },
                    { "ItemSize", 16 },
                    { "EnableDrag", true },
                    { "EnableDrop", true },
                    { "FileListNewWindowCommand", NullScriptCommand.Instance },      //Disable NewWindow Command.
                    { "EnableMultiSelect", true },
                    { "ShowToolbar", true },
                    { "ShowGridHeader", true },
                    { "OnModelCreated", IOInitializeHelpers.Explorer_Initialize_Default },
                    { "OnViewAttached", UIScriptCommands.ExplorerGotoStartupPathOrFirstRoot() }
                }
            };

            cbCommand.ItemsSource = ScriptCommandDictionary.CommandList;
        }