Beispiel #1
0
        void LoadTabIconForItem(ActivityItem view, TabType type, int versionNumber)
        {
            ImageView itemPicture = view.FindViewById <ImageView> (Resource.Id.ItemPicture);

            if (view.CurrentTabType != type.Name)
            {
                itemPicture.SetImageBitmap(type.Image);
            }
        }
Beispiel #2
0
        void LoadMapForItem(ActivityItem view, Tuple <double, double> latLng, int versionNumber)
        {
            FadeImageView mapView = view.FindViewById <FadeImageView> (Resource.Id.MapPicture);
            string        url     = BuildMapUrl(latLng, mapWidth, MapHeight);

            if (url == view.CurrentMapUri)
            {
                return;
            }

            Bitmap map = null;

            if (cache.TryGet(url, out map))
            {
                mapView.SetImageBitmap(map, true);
                view.CurrentMapUri         = url;
                view.CurrentMapCoordinates = latLng;
            }
            else
            {
                mapView.SetImageBitmap(NoMapPicture);
                Action doMapSetting = () => {
                    if (view.VersionNumber != versionNumber)
                    {
                        return;
                    }
                    activity.RunOnUiThread(() => {
                        if (view.VersionNumber != versionNumber)
                        {
                            return;
                        }
                        if (map == null)
                        {
                            cache.TryGet(url, out map);
                        }
                        mapView.SetImageBitmap(map, true);
                        view.CurrentMapUri         = url;
                        view.CurrentMapCoordinates = latLng;
                    });
                };
                if (pendingFetch.ContainsKey(url))
                {
                    pendingFetch [url].ContinueWith(t => doMapSetting(), TaskContinuationOptions.ExecuteSynchronously);
                }
                else
                {
                    pendingFetch[url] = SerialScheduler.Factory.StartNew(() => {
                        map = DownloadoCacher(url);
                        doMapSetting();
                    });
                }
            }
        }
 void LoadTabIconForItem(ActivityItem view, TabType type, int versionNumber)
 {
     ImageView itemPicture = view.FindViewById<ImageView> (Resource.Id.ItemPicture);
     if (view.CurrentTabType != type.Name)
         itemPicture.SetImageBitmap (type.Image);
 }
        void LoadMapForItem(ActivityItem view, Tuple<double, double> latLng, int versionNumber)
        {
            FadeImageView mapView = view.FindViewById<FadeImageView> (Resource.Id.MapPicture);
            string url = BuildMapUrl (latLng, mapWidth, MapHeight);

            if (url == view.CurrentMapUri)
                return;

            Bitmap map = null;
            if (cache.TryGet (url, out map)) {
                mapView.SetImageBitmap (map, true);
                view.CurrentMapUri = url;
                view.CurrentMapCoordinates = latLng;
            } else {
                mapView.SetImageBitmap (NoMapPicture);
                Action doMapSetting = () => {
                    if (view.VersionNumber != versionNumber)
                    return;
                    activity.RunOnUiThread (() => {
                        if (view.VersionNumber != versionNumber)
                            return;
                        if (map == null)
                            cache.TryGet (url, out map);
                        mapView.SetImageBitmap (map, true);
                        view.CurrentMapUri = url;
                        view.CurrentMapCoordinates = latLng;
                    });
                };
                if (pendingFetch.ContainsKey (url))
                    pendingFetch [url].ContinueWith (t => doMapSetting (), TaskContinuationOptions.ExecuteSynchronously);
                else
                    pendingFetch[url] = SerialScheduler.Factory.StartNew (() => {
                        map = DownloadoCacher (url);
                        doMapSetting ();
                    });
            }
        }