Exemple #1
0
        public override void Execute(object parameter)
        {
            var context = parameter as ContentTreeContext;

            if (context == null)
            {
                return;
            }

            var item = context.SelectedItems.FirstOrDefault() as FileTreeViewItem;

            if (item == null)
            {
                return;
            }

            if (item.HasChildren && !item.IsExpanded)
            {
                item.ExpandAndWait();
            }

            FileSortManager.SetFileSort(item.FileUri, SorterName);

            item.Refresh();
        }
        public override void Execute(object parameter)
        {
            var context = parameter as ContentTreeContext;

            if (context == null)
            {
                return;
            }

            var item = context.SelectedItems.FirstOrDefault() as FileTreeViewItem;

            if (item == null)
            {
                return;
            }

            FileSortManager.SetFileSort(item.FileUri, string.Empty);

            item.Refresh();
        }
        public override IEnumerable <ICommand> GetSubmenuCommands(object parameter)
        {
            Assert.ArgumentNotNull(parameter, nameof(parameter));

            var context = parameter as ContentTreeContext;

            if (context == null)
            {
                return(Enumerable.Empty <ICommand>());
            }

            var item = context.SelectedItems.FirstOrDefault() as FileTreeViewItem;

            if (item == null)
            {
                return(Enumerable.Empty <ICommand>());
            }

            var sorterName = FileSortManager.GetSorterName(item.FileUri);

            var result = new List <ICommand>(CommandManager.GetCommands(parameter, "FileSorting"));

            foreach (var name in FileSortManager.Names)
            {
                var command = new SetFileSort
                {
                    SorterName = name,
                    Text       = name,
                    IsChecked  = name == sorterName
                };

                result.Add(command);
            }

            return(result);
        }
        public override void Initialize([NotNull] Type type)
        {
            Assert.ArgumentNotNull(type, nameof(type));

            FileSortManager.LoadType(type, this);
        }