Exemplo n.º 1
0
        private void SelectListers()
        {
            if (Binding == null)
            {
                return;
            }

            _selectListers = true;
            Text           = "";
            Title          = "Choose Target Lister";
            var allListers = KexContainer.ResolveMany <ILister>()
                             .Where(l => !string.IsNullOrEmpty(l.Title))
                             .Where(l => l.ShowInMenu).Select(l => new BaseItem(l.Title)
            {
                Path = l.GetType().Name
            });

            var items = new[] { new BaseItem("All")
                                {
                                    Path = null
                                } }.Concat(allListers).ToList();

            BaseItems = items;
            var index = items.FindIndex(i => i.Path == SourceBinding?.Group);

            ItemsView.MoveCurrentToPosition(index);
        }
Exemplo n.º 2
0
        private MenuCommandBoundItem[] MenuCommandBoundItems(BitmapSource menuImg)
        {
            var items = new[]
            {
                new MenuCommandBoundItem("View", null)
                {
                    Items = new[]
                    {
                        new MenuCommandBoundItem("View Details",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ViewDetailsCommand)))),
                        new MenuCommandBoundItem("View Icons",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ViewIconsCommand)))),
                        new MenuCommandBoundItem("View Thumbnails",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ViewThumbnailsCommand))))
                    },
                    Thumbnail = menuImg
                },
                new MenuCommandBoundItem("Layout", null)
                {
                    Items = new[]
                    {
                        new MenuCommandBoundItem("Toggle Adressbar",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ToggleAdressbarVisibiblityCommand)))),
                        new MenuCommandBoundItem("Toggle Statusbar",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ToggleStatusbarVisibilityCommand)))),
                        new MenuCommandBoundItem("Toggle Detailspane",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ToggleFileDetailsVisibilityCommand)))),
                        new MenuCommandBoundItem("Toggle Treeview Pane",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ToggleTreeViewVisibilityCommand)))),
                        new MenuCommandBoundItem("Toggle Ribbonpane",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(ToggleRibbonVisibilityCommand)))),
                        new MenuCommandBoundItem("Load Layout",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(LoadLayoutCommand)))),
                        new MenuCommandBoundItem("Save Layout",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(SaveLayoutCommand))))
                    },
                    Thumbnail = menuImg
                },
                new MenuCommandBoundItem("Window", null)
                {
                    Items = new[]
                    {
                        new MenuCommandBoundItem("Adjust Width",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(AdjustListerWidthCommand)))),
                        new MenuCommandBoundItem("Adjust Column Width",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(AdjustColumnWidth)))),
                        new MenuCommandBoundItem("Split Horizontal",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowSplitHorizontalCommand)))),
                        new MenuCommandBoundItem("Split Vertical",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowSplitVerticalCommand)))),
                        new MenuCommandBoundItem("Move To Next Group",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(MoveToNextTabCommand)))),
                        new MenuCommandBoundItem("Move To Previous Group",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(MoveToPreviousTabCommand)))),
                        new MenuCommandBoundItem("Maximize",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowMaximizeCommand)))),
                        new MenuCommandBoundItem("Minimize",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowMinimizeCommand)))),
                        new MenuCommandBoundItem("Restore",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowRestoreCommand)))),
                        new MenuCommandBoundItem("Dock Left",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowDockLeftCommand)))),
                        new MenuCommandBoundItem("Dock Right",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowDockRightCommand)))),
                        new MenuCommandBoundItem("Center",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowCenterCommand)))),
                        new MenuCommandBoundItem("Full Height",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowFullHeightCommand)))),
                        new MenuCommandBoundItem("Next Monitor",
                                                 new RelayCommand(c => CommandRepository.Execute(nameof(WindowNextMonitorCommand))))
                    },
                    Thumbnail = menuImg
                },
                new MenuCommandBoundItem("Listers", null)
                {
                    //if injected in constructor: same listers/datasource for different process/services lister winodws => collection modified
                    Items = KexContainer.ResolveMany <ILister>()
                            .Where(l => !string.IsNullOrEmpty(l.Title))
                            .Where(l => l.ShowInMenu)
                            .Select(l => new MenuCommandBoundItem(l.Title, new RelayCommand(c =>
                    {
                        Workspace.Open(l);
                        l.Refresh();
                    }))),
                    Thumbnail = menuImg
                },
                new MenuCommandBoundItem("Options", new RelayCommand(c => CommandRepository.Execute(nameof(ShowSettingsListerCommand)))),
                new MenuCommandBoundItem("GroupBy", new RelayCommand(c => CommandRepository.Execute(nameof(ShowGroupByPopupCommand)))),
                new MenuCommandBoundItem("Sort", new RelayCommand(c => CommandRepository.Execute(nameof(ShowSortPopupCommand)))),
                new MenuCommandBoundItem("Toggle Hidden Items", new RelayCommand(c =>
                {
                    new ToggleHiddenItemsCommand(Workspace);
                    Workspace.ActiveLister.Refresh();
                })),
                new MenuCommandBoundItem("Refresh", new RelayCommand(c => CommandRepository.Execute(nameof(RefreshListerCommand)))),
                new MenuCommandBoundItem("Console Command", new RelayCommand(c => CommandRepository.Execute(nameof(ShowConsolePopupCommand)))),
                new MenuCommandBoundItem("Restart as Admin", new RelayCommand(c => CommandRepository.Execute(nameof(RestartAsAdminCommand)))),
                new MenuCommandBoundItem("Quit", new RelayCommand(c => CommandRepository.Execute(nameof(QuitCommand)))),
            };

            return(items);
        }