/// <summary> /// カテゴリの追加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void addButton_Click(object sender, RoutedEventArgs e) { InsertScrapbookDialog dialog = new InsertScrapbookDialog(); await dialog.ShowAsync(); if (!string.IsNullOrEmpty(dialog.FolderName)) { ScrapbookCategory category = new ScrapbookCategory() { FolderName = dialog.FolderName, }; if (EnvPath.GetScrapbookSubFolder(category.FolderName) != null) { m_db.InsertScrapbookCategory(category); } } }
/// <summary> /// 指定したカテゴリに登録するためのスクラップブックを作成しオブジェクトを返す /// </summary> /// <param name="category"></param> /// <returns></returns> public async Task <ScrapbookItem> CreateScrapbookItem(ScrapbookCategory category) { string fileName = EnvPath.CreateScrapbookFileName(); StorageFolder folder = await EnvPath.GetScrapbookSubFolder(category.FolderName); StorageFile copyFile = await m_reader.CopyFileAsync(this.SelectedIndex, folder, fileName); if (copyFile == null) { return(null); } return(new ScrapbookItem() { ScrapbookCategoryId = category.Id, FileName = Path.GetFileName(copyFile.Path), Uptime = DateTime.Now }); }