Example #1
0
        public void NewFolder()
        {
            var query = from item in this.Items
                        where item is BookmarkCategoryTreeViewItemViewModel
                        let viewModel = item as BookmarkCategoryTreeViewItemViewModel
                                        select viewModel.DisplayName;

            var dialog = new NewCategoryViewModel(PathUtility.Separator, query.ToArray());

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            try
            {
                var viewModel = this.Browser.BookmarkCategory.CreateInstance(dialog.CategoryPath, this.Browser);
                this.Items.Add(viewModel);
                this.Items.Reposition(viewModel);
                this.IsExpanded = true;
                this.Browser.UpdateBookmarkItems();
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
            }
        }
Example #2
0
        public void NewFolder()
        {
            var dialog = new NewCategoryViewModel(this.category.Path, item => this.category.Categories.ContainsKey(item) == false);

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            try
            {
                this.category.CreateCategory(dialog.CategoryName);
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
            }
        }
Example #3
0
        public void NewFolder()
        {
            var categoryPaths = GetAllCategoryPaths(this);
            var dialog        = new NewCategoryViewModel(this.categoryPath, categoryPaths);

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            var categoryName = new CategoryName(this.categoryPath, dialog.CategoryName);
            var viewModel    = new CategoryTreeViewItemViewModel(this.dataSet, categoryName.Path, this.selector)
            {
                Parent = this,
            };

            this.IsExpanded      = true;
            viewModel.IsSelected = true;
        }
Example #4
0
        public void NewFolder()
        {
            var categoryPaths = this.dataSet.ExtendedProperties[CremaSchema.TypeDirectory] as string[];
            var dialog        = new NewCategoryViewModel(this.categoryPath, categoryPaths);

            if (dialog.ShowDialog() != true)
            {
                return;
            }

            var categoryName = new CategoryName(this.categoryPath, dialog.CategoryName);
            var viewModel    = new CategoryTreeViewItemViewModel(this.dataSet, categoryName.Path, this.selector)
            {
                Parent = this,
            };
            var categoryPathList = categoryPaths.ToList();

            categoryPathList.Add(categoryName.Path);
            this.dataSet.ExtendedProperties[CremaSchema.TypeDirectory] = categoryPathList.OrderBy(item => item).ToArray();
            this.IsExpanded      = true;
            viewModel.IsSelected = true;
        }