private bool UpdateBook(CalilCheckResult item) { bool bUpdate = false; foreach (ViewModel.SearchResultBook book in this.BookResultList) { if (book.ISBN == item.Isbn) { bUpdate = true; string systemName; int totalLibraryCount; { CheckTargetLibrarys lib = new CheckTargetLibrarys(); systemName = lib.GetSystemName(item.SystemId); totalLibraryCount = lib.Librarys.Count(); } book.Update(item, systemName, totalLibraryCount); if (item.Status == CheckState.Running) { this.UpdateStatus("「" + book.Title + "」の蔵書検索中"); System.Diagnostics.Debug.WriteLine(this.Status); } break; } } return(bUpdate); }
/// <summary> /// ViewCellに表示するための図書館情報リストを取得する /// </summary> /// <returns>The library group list.</returns> /// <param name="systemIdLibraryTable">図書館群をsystem名単位のグループ< system名, 図書館リスト ></param> public static List <LibraryGroup> GetLibraryGroupList(Dictionary <string, List <CalilLibrary> > systemIdLibraryTable) { List <LibraryGroup> libraryGropuList = new List <LibraryGroup>(); CheckTargetLibrarys targetLibrary = new CheckTargetLibrarys(); //登録済み図書館 foreach (KeyValuePair <string, List <CalilLibrary> > item in systemIdLibraryTable) { bool isRegist = targetLibrary.IsRegist(item.Key); List <string> shortNameList = new List <string>(); foreach (var name in item.Value) { shortNameList.Add(name.Short); } libraryGropuList.Add(new LibraryGroup(item.Key, shortNameList, isRegist)); } return(libraryGropuList); }
public LibraryCell() { Label deleteLabel = new Label() { Text = "[削除]", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), }; var tgr = new TapGestureRecognizer(); tgr.Tapped += (sender, e) => { CheckTargetLibrarys targetLibrarys = new CheckTargetLibrarys(); targetLibrarys.DelLibrary((CheckTargetLibrary)BindingContext); }; deleteLabel.GestureRecognizers.Add(tgr); //systemname var systemName = new Label { FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalTextAlignment = TextAlignment.Center, LineBreakMode = LineBreakMode.TailTruncation, }; systemName.SetBinding(Label.TextProperty, "systemname"); View = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { systemName, deleteLabel }, VerticalOptions = LayoutOptions.Start, }; }
public SettingPage() { //GA-> //設定ページ表示してお問い合わせする人の割合を計測する GoogleAnalytics.Current.Tracker.SendView("SettingPage"); //GA<- BindingContext = new CheckTargetLibrarys(); this.Title = "設定"; var labelStyleDetailContent = new Style(typeof(Label)) { Setters = { new Setter { Property = BackgroundColorProperty, Value = Color.Yellow }, } }; //図書館追加とリスト表示 var libraryCommentLabel = new Label { Text = "図書館の設定 (最大 5 件まで登録可能)", Style = labelStyleDetailContent, }; var registLibraryButton = new Button { Text = "図書館を登録する", }; registLibraryButton.Clicked += (sender, e) => { Navigation.PushAsync(new SelectPrefecturePage()); }; libraryListView = new ListView { ItemTemplate = new DataTemplate(typeof(LibraryCell)), //セルの指定 ItemsSource = ((CheckTargetLibrarys)BindingContext).Librarys, VerticalOptions = LayoutOptions.Start, HeightRequest = (((CheckTargetLibrarys)BindingContext).Librarys.Count()) * (Cell.DefaultCellHeight + 10), }; libraryListView.ItemSelected += (sender, e) => { if (e.SelectedItem == null) { return; } ((ListView)sender).SelectedItem = null; }; //お問い合わせボタン var requestFormLabel = new Label { Text = "質問や改善要望の受付(どんなフィードバックも歓迎)", Style = labelStyleDetailContent, }; var requestFormButton = new Button { Text = "お問い合わせフォームへ移動", }; requestFormButton.Clicked += (sender, e) => { //GA-> //設定ページ表示してお問い合わせする人の割合を計測する GoogleAnalytics.Current.Tracker.SendEvent("SettingPage", "RequestForm"); //GA<- DependencyService.Get <IWebBrowserService>().Open(new Uri("https://docs.google.com/forms/d/e/1FAIpQLSfeIr1kPfVb87bbIVZX9pgOW_6ks6Wll2zOg-PjjRlAyVmByQ/viewform?usp=sf_link")); }; CrateExportView(labelStyleDetailContent); var layout = new StackLayout { Children = { libraryCommentLabel, registLibraryButton, libraryListView, requestFormLabel, requestFormButton, exportLabel, exportButton, importButton, }, }; this.Content = layout; }
public SelectLibraryPage(string apiKey, string pref, string city, string jsonResponseLibrary) { try { systemIdLibraryTable = LibraryGroup.getSystemIDLibraryTable(jsonResponseLibrary); List <LibraryGroup> libraryGropuList = LibraryGroup.GetLibraryGroupList(systemIdLibraryTable); ListView listView = new ListView { ItemTemplate = new DataTemplate(typeof(LibraryCell)),//セルの指定 ItemsSource = libraryGropuList, HasUnevenRows = true, }; // Define a selected handler for the ListView. listView.ItemSelected += async(sender, args) => { if (args.SelectedItem == null) { return; } ((ListView)sender).SelectedItem = null; var item = (LibraryGroup)args.SelectedItem; CheckTargetLibrarys targetLibrarys = new CheckTargetLibrarys(); if (item.IsRegist) { item.UpdateStatus(false); //DBから図書館を削除 targetLibrarys.DelLibrary(item.SystemName); } else { const int MAX_LIBRARY_NUM = 5; if (targetLibrarys.Librarys.Count() >= MAX_LIBRARY_NUM) { await DisplayAlert("図書館の登録", "6件以上は登録できません", "OK"); return; } //GA-> //図書館を仮想的に利用して膨大な蔵書を育てる人が多い事の検証。図書館追加することを検証する int libraryNum = targetLibrarys.Librarys.Count() + 1; GoogleAnalytics.Current.Tracker.SendEvent("SelectLibraryPage", "AddLibrary", libraryNum.ToString()); //GA<- item.UpdateStatus(true); //図書館をDBに登録する foreach (var keyValuePair in systemIdLibraryTable) { if (keyValuePair.Key == item.SystemName) { var library = keyValuePair.Value.First(); targetLibrarys.AddLibrary(library.systemid, library.systemname); } } } }; this.Content = listView; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.ToString()); } }