Пример #1
0
        public bool CanMoveItemUp()
        {
            if (SelectedTreeViewItem == null)
            {
                return(false);
            }
            if (SelectedTreeViewItem is CategoryViewModel)
            {
                return(SubItems.CanMoveItemUp(SelectedTreeViewItem as CategoryViewModel));
            }
            else if (SelectedTreeViewItem is StoryViewModel)
            {
                StoryViewModel vm = SelectedTreeViewItem as StoryViewModel;
                if (vm.Model.CategoryId == null)
                {
                    return(SubItems.CanMoveItemUp(vm));
                }
                else
                {
                    CategoryViewModel category = Categories.Single(i => i.Model.id == vm.Model.CategoryId);
                    return(category.Stories.CanMoveItemUp(vm));
                }
            }
            else if (SelectedTreeViewItem is ChapterViewModel)
            {
                ChapterViewModel vm = SelectedTreeViewItem as ChapterViewModel;
                return(vm.StoryVm.Chapters.CanMoveItemUp(vm));
            }
            else if (SelectedTreeViewItem is SceneViewModel)
            {
                SceneViewModel vm = SelectedTreeViewItem as SceneViewModel;
                return(vm.ChapterVm.Scenes.CanMoveItemUp(vm));
            }

            return(false);
        }