コード例 #1
0
        public async void FillUpMap(bool forceRefresh)
        {
            if (loading)
            {
                return;
            }
            loading = true;
            if (pane != null && pane.Opened)
            {
                pane.SetState(InfoPane.State.Closed, animated: false);
            }
            flashBar.ShowLoading();

            try
            {
                var stations = await pronto.GetStations(forceRefresh);

                if (stations.Length == 0)
                {
                    Toast.MakeText(Activity, Resource.String.load_error, ToastLength.Long).Show();
                }
                else
                {
                    await SetMapStationPins(stations);
                }
                lastUpdateText.Text = "Last refreshed: " + DateTime.Now.ToShortTimeString();
            }
            catch (Exception e)
            {
                e.Data["method"] = "FillUpMaps";
                Xamarin.Insights.Report(e);
                Android.Util.Log.Debug("DataFetcher", e.ToString());
            }

            flashBar.ShowLoaded();
            showedStale = false;
            loading     = false;
        }