Esempio n. 1
0
        async void UpdateLibraries(string pref, string city)
        {
            var calilApi  = new CalilApi();
            var libraries = await calilApi.GetLibraryAsync(pref, city);

            listView.ItemsSource = libraries.Select(library => library.Name);
            listView.ItemTapped += async(sender, e) =>
            {
                var favorites = LibraryEntity.GetAll().ToList();
                var selected  = libraries.Where(library => library.Name == (string)e.Item).First();

                if (favorites.Contains(selected))
                {
                    await DisplayAlert("確認", "登録済みです", "閉じる");

                    return;
                }

                var yes = await DisplayAlert("登録", String.Format("{0}を登録しますか?", selected.Name), "はい", "いいえ");

                if (yes)
                {
                    selected.Write();
                    await Navigation.PopModalAsync(true);
                }
            };
        }
Esempio n. 2
0
        async Task UpdateLibraries(string pref)
        {
            var calilApi  = new CalilApi();
            var libraries = await calilApi.GetLibraryAsync(pref);

            listView.ItemsSource = libraries.Select(library => library.City).Distinct().OrderBy(library => library);
            return;
        }