public async Task NewFolderAsync() { 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 (await dialog.ShowDialogAsync() != true) { return; } try { var viewModel = this.CreateInstance(dialog.CategoryPath, this.Browser); this.Items.Add(viewModel); this.Items.Reposition(viewModel); this.IsExpanded = true; this.Browser.UpdateBookmarkItems(); } catch (Exception e) { await AppMessageBox.ShowErrorAsync(e); } }
public async Task NewFolderAsync() { var dialog = new NewCategoryViewModel(this.category.Path, item => this.category.Categories.ContainsKey(item) == false); if (await dialog.ShowDialogAsync() != true) { return; } try { this.category.CreateCategory(dialog.CategoryName); } catch (Exception e) { await AppMessageBox.ShowErrorAsync(e); } }
public async Task NewFolderAsync() { var categoryPaths = GetAllCategoryPaths(this); var dialog = new NewCategoryViewModel(this.categoryPath, categoryPaths); if (await dialog.ShowDialogAsync() != 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; }
public async Task NewFolderAsync() { var categoryPaths = this.dataSet.ExtendedProperties[CremaSchema.TypeDirectory] as string[]; var dialog = new NewCategoryViewModel(this.categoryPath, categoryPaths); if (await dialog.ShowDialogAsync() != 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; }