コード例 #1
0
        private async Task EditStashTabAsync(StashBookmarkViewModel bookmarkVm)
        {
            var bookmark = bookmarkVm.Bookmark;
            var vm       = new TabPickerViewModel
            {
                Color = bookmark.Color,
                Name  = bookmark.Name
            };
            var result = await _dialogCoordinator.EditStashTabAsync(this, vm);

            switch (result)
            {
            case TabPickerResult.Delete:
                Bookmarks.Remove(bookmarkVm);
                _persistentData.StashBookmarks.Remove(bookmark);
                break;

            case TabPickerResult.DeleteIncludingItems:
                var confirmationResult = await _dialogCoordinator.ShowQuestionAsync(this,
                                                                                    L10n.Message(
                                                                                        "This will delete all items between this and the next bookmark and can not be undone.\nDo you want to continue?"),
                                                                                    title : L10n.Message("Delete items"));

                if (confirmationResult == MessageBoxResult.Yes)
                {
                    DeleteBookmarkAndItems(bookmarkVm);
                }
                break;

            case TabPickerResult.Affirmative:
                bookmark.Name  = vm.Name;
                bookmark.Color = vm.Color;
                break;
            }
        }
コード例 #2
0
        private async Task AddStashTabAsync()
        {
            var vm = new TabPickerViewModel
            {
                IsDeletable = false
            };
            var result = await _dialogCoordinator.EditStashTabAsync(this, vm);

            if (result == TabPickerResult.Affirmative)
            {
                AddStashTab(new StashBookmark(vm.Name, (int)ScrollBarValue + 1, vm.Color));
            }
        }