private async void ToolbarItem_Clicked_Rename(object sender, EventArgs e) { var options = new ObservableCollection <EntryWithOptionViewModel.EntryWithOptionViewModelEntry>(); if (!string.IsNullOrEmpty(Model.WordbookTitleUser) && Model.WordbookTitleUser != Model.WordbookTitleHtml) { var item = new EntryWithOptionViewModel.EntryWithOptionViewModelEntry(Model.WordbookTitleUser, Model.WordbookTitleUser); options.Add(item); } if (!string.IsNullOrEmpty(Model.WordbookTitleHtml)) { var item = new EntryWithOptionViewModel.EntryWithOptionViewModelEntry(Model.WordbookTitleHtml, Model.WordbookTitleHtml); options.Add(item); } foreach (var item in RemoteStorage.GetNameSuggestions(Model.Uri)) { if (item != Model.WordbookTitleUser) { options.Add(new EntryWithOptionViewModel.EntryWithOptionViewModelEntry(item, item)); } } if (Model == null) { return; } var vm = (new EntryWithOptionViewModel(AppResources.WordbookRenameMessage, options, Model.WordbookTitle)); var page = new EntryWithOptionPage(vm); var waitHandle = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.AutoReset); page.Disappearing += (s, e2) => waitHandle.Set(); await Navigation.PushAsync(page); await Task.Run(() => waitHandle.WaitOne()); var tmp = vm.GetValue <string>(); if (tmp.Item2) { Model.WordbookTitleUser = tmp.Item1; await WordbooksImpressStorage.SaveLocalData(); } }
private async void ToolbarItem_Clicked_Delete(object sender, EventArgs e) { if (Model.HasMultipleWordbook) { await DisplayAlert(AppResources.WordWarning, AppResources.WordbookAlertCannotDelete, AppResources.AlertConfirmed); return; } var alertResult = await DisplayAlert(AppResources.WordWarning, AppResources.WordbookAlertConfirmDelete, AppResources.AlertYes, AppResources.AlertNo); if (!alertResult) { return; } WordbooksImpressStorage.Content.Remove(Model.Wordbooks[0]); await WordbooksImpressStorage.SaveLocalData(); //認証情報を削除するか。迷うが削除しない事にする。 //WordbooksImpressInfoStorage.Content.RemoveAll((w) => w.Url == Model.Wordbook.Uri); //WordsPageSemaphore.Dispose(); await Navigation.PopAsync(); }