Beispiel #1
0
        /// <summary>
        /// 指定したアイテムを削除する
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void deleteItemButton_Click(object sender, RoutedEventArgs e)
        {
            FolderListItem item = (sender as MenuFlyoutItem).DataContext as FolderListItem;

            if (item == null)
            {
                return;
            }

            MessageDialog dialog = new MessageDialog(item.Name + "を本棚から削除しますか?", "確認");

            dialog.Commands.Add(new UICommand("OK", (command) => {
                //TODO:ここに削除処理
                BookCategory category = m_db.QueryBookCategory(item.Name);
                foreach (BookItem bookItem in m_db.QueryBookItemList(category))
                {
                    StorageHistoryManager.RemoveStorage(bookItem.Token, StorageHistoryManager.DataType.Bookshelf);
                }
                m_db.DeleteBookCategory(category);

                this.ViewModel.Init(m_naviParam);
            }));
            dialog.Commands.Add(new UICommand("キャンセル"));
            dialog.DefaultCommandIndex = 1;
            await dialog.ShowAsync();
        }
Beispiel #2
0
        /// <summary>
        /// 指定した本棚カテゴリから削除する
        /// </summary>
        /// <param name="category"></param>
        private void removeBookItem(BookCategory category)
        {
            BookItem bookItem = m_db.QueryBookItemFromPath(category.Id, this.ViewModel.ParentStorage.Path);

            if (bookItem != null)
            {
                StorageHistoryManager.RemoveStorage(bookItem.Token, StorageHistoryManager.DataType.Bookshelf);
                m_db.DeleteBookItem(bookItem);
            }
        }