Stores and updates info about where the bikes are TfL have more info on the data they provide here http://www.tfl.gov.uk/businessandpartners/syndication/default.aspx this normally calls a AppEngine service which returns a pipe-seperates list, very much like baselist.txt, but it's live, coming from the TFL urls
Exemple #1
0
 public BikeElement(BikeLocation bike, NSAction action) : base("", "", action)
 {
     Bike      = bike;
     Caption   = bike.Name;
     Value     = GetValueString();
     Accessory = UITableViewCellAccessory.DisclosureIndicator;
 }
 public void UpdateCompass(int heading)
 {
     if (compassView != null && CompassIsOn)
     {
         compassView.UpdateCompassLabel(BikeLocation.HeadingToString(heading));
     }
 }
Exemple #3
0
 public BikeElement(BikeLocation bike, NSAction action)
     : base("","",action)
 {
     Bike = bike;
     Caption = bike.Name;
     Value = GetValueString();
     Accessory = UITableViewCellAccessory.DisclosureIndicator;
 }
Exemple #4
0
        public void SetFocusOnLocation(BikeLocation bike)
        {
            UIView.BeginAnimations("foo");
            UIView.SetAnimationDuration(1);

            tabBar.SelectedIndex = 1;

            UIView.SetAnimationTransition(UIViewAnimationTransition.None, tabBar.View, true);
            UIView.CommitAnimations();
            map.FocusOnLocation(bike);
        }
        public override void ViewDidAppear(bool animated)
        {
            Util.Log("NearView: Appear");
            NavigationController.NavigationBar.TintColor = Resources.DarkBlue;

            ToggleTapHereView();

            BikeLocation.UpdateFromWebsite(delegate {
                InvokeOnMainThread(delegate {
                    Util.AppDelegate.map.RefreshPinColours();
                    RefreshData();
                });
            });
        }
        public NearDialogViewController() : base(null, false)
        {
            Title = "Nearest Bikes";

            this.RefreshRequested += delegate {
                if (!BikeLocation.UpdateFromWebsite(delegate {
                    InvokeOnMainThread(delegate {
                        Util.AppDelegate.map.RefreshPinColours();
                        RefreshData();

                        ReloadComplete();
                    });
                }))
                {
                    ReloadComplete();
                }
            };

            this.Style = MonoTouch.UIKit.UITableViewStyle.Plain;

            refreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, delegate {
                if (!updating)
                {
                    updating = true;
                    BikeLocation.UpdateFromWebsite(delegate {
                        InvokeOnMainThread(delegate {
                            Util.AppDelegate.map.RefreshPinColours();
                            RefreshData();
                        });
                    });

                    HasList = true;
                    ToggleTapHereView();
                    UpdateNearestList();
                }
            });

            NavigationItem.RightBarButtonItem = refreshButton;

            if (CLLocationManager.HeadingAvailable)
            {
                compassButton = new UIBarButtonItem(Resources.Compass, UIBarButtonItemStyle.Bordered, delegate {
                    ToggleCompassView();
                });

                NavigationItem.LeftBarButtonItem = compassButton;
            }
        }
Exemple #7
0
        public static void StartNewTripItem()
        {
            currentTripLog                  = new TripLog();
            currentTripLog.Ticks            = DateTime.Now.Ticks;
            currentTripLog.TimeInSeconds    = -1;
            currentTripLog.DistanceInMeters = -1;

            GetCurrentLocation(currentTripLog, true, delegate {
                Util.Log("Found Start location");

#if DEBUG
#if FAKEDATA
                currentTripLog.StartLat = Locations.HydePark.Latitude;
                currentTripLog.StartLon = Locations.HydePark.Longitude;
#endif
#endif

                BikeLocation loc = BikeLocation.FindClosestBike(currentTripLog.StartLat, currentTripLog.StartLon);
                if (loc != null)
                {
                    if (loc.DistanceFromCurrentPoint > 500)
                    {
                        currentTripLog.StartStation = "Unknown";
                    }
                    else
                    {
                        currentTripLog.StartStation = loc.Name;
                    }
                }
                else
                {
                    currentTripLog.StartStation = "Unknown";
                }

                Util.Log("Station: " + currentTripLog.StartStation);

                NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;

                defaults.SetString(currentTripLog.AsLine, "triplog_line");
                defaults.Synchronize();
            });
        }
Exemple #8
0
        public override void ViewDidAppear(bool animated)
        {
            Util.Log("MapView: Appear");
            NavigationController.NavigationBar.TintColor = Resources.DarkBlue;


            //if (gpsButton != null) NavigationItem.RightBarButtonItem = gpsButton;

            BikeLocation.UpdateFromWebsite(delegate {
                InvokeOnMainThread(delegate {
                    RefreshPinColours();
                    //RefreshData();
                });
            });

            if (userLocationWasOn)
            {
                mapView.ShowsUserLocation = true;
            }
            userLocationWasOn = false;
        }
Exemple #9
0
        public void FocusOnLocation(BikeLocation bike)
        {
            HideDistanceView();

            RemoveRouteAnnotation();

            foreach (CycleAnnotation an in mapView.Annotations)
            {
                if (an.Bike == bike)
                {
                    MKCoordinateRegion region = new MKCoordinateRegion(an.Bike.Location, new MKCoordinateSpan(0.01, 0.01));

                    region = mapView.RegionThatFits(region);

                    mapView.SetRegion(region, true);
                    mapView.SelectAnnotation(an, true);



                    mapView.ShowsUserLocation = true;
                    return;
                }
            }
        }
 public static void RemoveBike(BikeLocation location)
 {
     allBikes.Remove(location);
     bikesById.Remove(location.UniqueId);
 }
Exemple #11
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            //TripLog.MakeDummyData();

            Util.Log("In finished launching (with options)");


            bool localNotification = false;

            if (options != null)
            {
                if (Util.IsIOS4OrBetter)
                {
                    UILocalNotification localNotif = (UILocalNotification)options.ObjectForKey(UIApplication.LaunchOptionsLocalNotificationKey);

                    if (localNotif != null)
                    {
                        localNotification = true;
                    }
                }
            }

            Util.LogStartup();


            var bikes = BikeLocation.AllBikes;


            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque;
            tabBar = new UITabBarController(); MainView = tabBar.View;
            window.AddSubview(MainView);


            near     = new NearDialogViewController();
            map      = new MapViewController();
            tripLog  = new TripLogViewController();
            infoPage = new InfoViewController();


            timer = new TimerViewController {
                TabBarItem = new UITabBarItem("Timer", Resources.Timer, 1)
            };

            tabControllers = new UIViewController[] {
                new UINavigationController(near)
                {
                    TabBarItem = new UITabBarItem("Near", Resources.Near, 0)
                },
                new UINavigationController(map)
                {
                    TabBarItem = new UITabBarItem("Map", Resources.Map, 2)
                },
                timer,
                new UINavigationController(tripLog)
                {
                    TabBarItem = new UITabBarItem("Trip Log", Resources.TripLog, 3)
                },
                new UINavigationController(infoPage)
                {
                    TabBarItem = new UITabBarItem("Info", Resources.Info, 4)
                }
            };


            tabBar.SetViewControllers(tabControllers, false);

            if (localNotification)
            {
                tabBar.SelectedIndex = 2;
            }

            window.MakeKeyAndVisible();

            BikeLocation.UpdateFromWebsite(delegate {
                Util.Log("Update on startup done");
                map.RefreshPinColours();
            });

            Appirator.AppLaunched();
            Analytics.AppLaunched();

            return(true);
        }
Exemple #12
0
 public static void AddBike(BikeLocation location)
 {
     allBikes.Add(location);
     bikesById.Add(location.UniqueId, location);
 }
Exemple #13
0
 public static void RemoveBike(BikeLocation location)
 {
     allBikes.Remove(location);
     bikesById.Remove(location.UniqueId);
 }
 public static void AddBike(BikeLocation location)
 {
     allBikes.Add(location);
     bikesById.Add(location.UniqueId, location);
 }
 public CycleAnnotation(BikeLocation bike)
     : base()
 {
     Bike = bike;
 }
Exemple #16
0
        public static bool UpdateFromWebsite(NSAction onDone)
        {
            if (isUpdating) return false;

            isUpdating = true;

            Analytics.TrackPageView("/download");
            Analytics.TrackEvent(Analytics.CATEGORY_ACTION, Analytics.ACTION_DOWNLOAD, "", 1);

            ThreadPool.QueueUserWorkItem(delegate {

                using (NSAutoreleasePool pool = new NSAutoreleasePool())
                {

                    Util.Log("updating.....");

                    if (Util.IsReachable("www.fastchicken.co.nz"))
                    {

                        //Thread.Sleep(500);

                        Util.TurnOnNetworkActivity();

                        try {

                            string s = "";
                            try
                            {
                                var wc = new WebClient();
                                //this would normally call the live service. This one is the same, but a static file
                                s = wc.DownloadString("http://www.fastchicken.co.nz/lba/docks.txt");
                            } catch (Exception ex)
                            {
                                Util.Log("Error downloading from the server.");
                                Util.Log(ex.Message);
                                return;
                            }

                            if (s == "KEY NOT VALID")
                                return;
                            string[] items = s.Split('^');

                            foreach(BikeLocation bike in AllBikes)
                            {
                                bike.Touched = false;
                            }

                            foreach(var item in items)
                            {
                                string[] bits = item.Split('|');

                                try {

                                    BikeLocation location = null;

                                    if (bikesById.ContainsKey(bits[0]))
                                    {
                                        location = bikesById[bits[0]];
                                    } else
                                    {
                                        location = new BikeLocation(bits, true);
                                        AddBike(location);
                                    }

                                    location.DocksAvailable = -1;
                                    location.IsAvailable = bits[4].ToLower() == "true";
                                    location.DocksAvailable = Int32.Parse(bits[6]);
                                    location.Capacity = Int32.Parse(bits[5]);
                                    if (bits.Length == 8)
                                    {
                                        location.BikesAvailable = Int32.Parse(bits[7]);
                                    } else
                                    {
                                        location.BikesAvailable = location.Capacity - location.DocksAvailable;
                                    }
                                    location.Touched = true;

                                } catch
                                {
                                    //do nothing

                                }

                            }

                            List<BikeLocation> DocksToRemove = new List<BikeLocation>();
                            foreach(BikeLocation bike in AllBikes)
                            {
                                if (!bike.Touched)
                                {
                                    Util.Log("Found untouched bike: {0}", bike.Name);
                                    DocksToRemove.Add(bike);
                                }
                            }

                            foreach(BikeLocation bike in DocksToRemove)
                            {
                                RemoveBike(bike);

                            }

                            WriteToPersistentFile();

                            Util.Log("updated");

                        } finally {
                            Util.TurnOffNetworkActivity();
                            isUpdating = false;
                        }
                        if (onDone != null) onDone();

                    } else Util.Log("No network or website not reachable");

                }
            });

            return true;
        }
Exemple #17
0
        public static void StopTripItem(int totalTime)
        {
            if (currentTripLog == null)
            {
                NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults;


                string line = defaults.StringForKey("triplog_line");

                if (string.IsNullOrEmpty(line))
                {
                    return;
                }

                currentTripLog = new TripLog(line.Split('|'));
            }

            currentTripLog.TimeInSeconds = totalTime;

            GetCurrentLocation(currentTripLog, false, delegate {
#if DEBUG
#if FAKEDATA
                currentTripLog.EndLat        = Locations.BanksideMix.Latitude;
                currentTripLog.EndLon        = Locations.BanksideMix.Longitude;
                currentTripLog.TimeInSeconds = 1120;
#endif
#endif

                Util.Log("Found End location");
                BikeLocation loc = BikeLocation.FindClosestBike(currentTripLog.EndLat, currentTripLog.EndLon);
                if (loc != null)
                {
                    if (loc.DistanceFromCurrentPoint > 500)
                    {
                        currentTripLog.EndStation = "Unknown";
                    }
                    else
                    {
                        currentTripLog.EndStation = loc.Name;
                    }
                }
                else
                {
                    currentTripLog.EndStation = "Unknown";
                }
                currentTripLog.DistanceInMeters = (int)BikeLocation.CalculateDistanceInMeters(
                    new CLLocationCoordinate2D(currentTripLog.StartLat, currentTripLog.StartLon),
                    new CLLocationCoordinate2D(currentTripLog.EndLat, currentTripLog.EndLon));
                BikeLocation.LogTrip(currentTripLog.TimeInSeconds, currentTripLog.DistanceInMeters);

                Util.Log("End Station: " + currentTripLog.EndStation);
                allTrips.Insert(0, currentTripLog);



                PersistToDisk();

                if (allTrips.Count > 0)
                {
                    ReverseGeocode(allTrips [0]);
                }
            });
        }
        public void UpdateNearestList()
        {
            if (!CLLocationManager.LocationServicesEnabled)
            {
                alert = new UIAlertView("No Location Available", "Sorry, no location services are available. However, you may still be able to use the timer and map.", null, "Ok");
                alert.Show();
                updating = false;
                return;
            }

            if (locationManager == null)
            {
                locationManager = new CLLocationManager();
                locationManager.DesiredAccuracy = CLLocation.AccuracyNearestTenMeters;



                locationDelegate = new MyLocationManagerDelegate();
                locationDelegate.OnLocationError += delegate(NSError error) {
                    alert = new UIAlertView("No Location Available", "Sorry, but there was an error finding your location. However, you may still be able to use the timer and map.", null, "Ok");
                    alert.Show();

                    updating = false;
                };

                locationDelegate.OnHeadingUpdate += delegate(CLHeading heading) {
                    Util.Log("heading: " + heading.TrueHeading);

                    UpdateCompass((int)heading.TrueHeading);
                };
                locationDelegate.OnLocationUpdate += delegate(CLLocation location) {
                    CLLocationCoordinate2D coord = location.Coordinate;
#if DEBUG
                    coord = Locations.BanksideMix;
#endif


                    var bikeList = BikeLocation.FindClosestBikeList(coord.Latitude, coord.Longitude);

                    RootElement root = new RootElement("Nearest Bikes");
                    HasList = true;



                    Section section = new Section();
                    int     i       = 0;

                    if (location.HorizontalAccuracy > 100)
                    {
                        section.Add(new StringElement("Low GPS accuracy!")
                        {
                            Alignment = UITextAlignment.Center
                        });
                    }



                    foreach (BikeLocation bike in bikeList)
                    {
                        var localBike = bike;



                        section.Add(new BikeElement(localBike, delegate {
                            Util.AppDelegate.SetFocusOnLocation(localBike);
                        }));



                        i++;
                        if (i > 20)
                        {
                            break;
                        }
                    }

                    root.Add(section);


                    Root = root;

                    updating = false;

                    BikeLocation.LogSearch();
                };
                locationManager.Delegate = locationDelegate;
            }

            locationManager.StartUpdatingLocation();
            locationDelegate.StartTimer(locationManager);
            Util.TurnOnNetworkActivity();
        }
Exemple #19
0
        public MapViewController() : base()
        {
            BuildView();

            NavigationItem.Title = "Map";



            segmentControl = new UISegmentedControl(new RectangleF(0, 0, 200, 25));
            segmentControl.InsertSegment("Find bikes", 0, false);
            segmentControl.InsertSegment("Find docks", 1, false);
            segmentControl.SelectedSegment = 0;
            segmentControl.ControlStyle    = UISegmentedControlStyle.Bar;
            segmentControl.ValueChanged   += delegate(object sender, EventArgs e) {
                if (segmentControl.SelectedSegment == 0)
                {
                    CurrentDisplayMode = DisplayMode.Bikes;
                    Analytics.TrackEvent(Analytics.CATEGORY_ACTION, Analytics.ACTION_MAP_BIKES, "", 1);
                }
                else
                {
                    CurrentDisplayMode = DisplayMode.Docks;
                    Analytics.TrackEvent(Analytics.CATEGORY_ACTION, Analytics.ACTION_MAP_DOCKS, "", 1);
                }

                RefreshPinColours();

                BikeLocation.UpdateFromWebsite(delegate {
                    InvokeOnMainThread(delegate {
                        RefreshPinColours();
                        //RefreshData();
                    });
                });
            };


            NavigationItem.TitleView = segmentControl;


            NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Resources.Routing, UIBarButtonItemStyle.Bordered, delegate {
                //nulls, think about the nulls!

                if (!CLLocationManager.LocationServicesEnabled)
                {
                    alert = new UIAlertView("No Location Available", "Sorry, no location services are available. However, you may still be able to use the timer and map.", null, "Ok");
                    alert.Show();
                    return;
                }

                if (mapView.UserLocation == null || mapView.UserLocation.Location == null)
                {
                    alert = new UIAlertView("No Location Available", "Sorry, your location is not yet available.", null, "Ok");
                    alert.Show();
                    return;
                }



                NSObject[] selectedPins = mapView.SelectedAnnotations;

                if (selectedPins == null || selectedPins.Length > 1)
                {
                    alert = new UIAlertView("Select a dock", "Please pick a cycle docking station to route to.", null, "Ok");
                    alert.Show();
                    return;
                }



                if (selectedPins.Length == 1)
                {
                    CycleAnnotation ca = selectedPins[0] as CycleAnnotation;
                    if (ca != null)
                    {
                        HideDistanceView();

                        var location = mapView.UserLocation.Location.Coordinate;
#if DEBUG
                        location = Locations.BanksideMix;
#endif

                        double distance = BikeLocation.CalculateDistanceInMeters(location, ca.Coordinate);
                        if (distance > 50000)
                        {
                            alert = new UIAlertView("Sorry, your route is too long", "We can only plot cycle routes up to 50km.", null, "Ok");
                            alert.Show();


                            return;
                        }



                        loadingView = new ActivityIndicatorLoadingView();
                        loadingView.Show("Finding your route");
                        Util.TurnOnNetworkActivity();


                        RemoveRouteAnnotation();



                        ThreadPool.QueueUserWorkItem(delegate {
                            using (NSAutoreleasePool newPool = new NSAutoreleasePool())
                            {
                                location = mapView.UserLocation.Location.Coordinate;
#if DEBUG
                                location = Locations.BanksideMix;
#endif

                                MapRouting routing = new MapRouting(location, ca.Coordinate);



                                //routing.FindRoute(delegate {
                                routing.FindRoute(delegate {
                                    InvokeOnMainThread(delegate {
                                        //Console.WriteLine("updating");
                                        loadingView.Hide();
                                        Util.TurnOffNetworkActivity();
                                        if (routing.HasRoute)
                                        {
                                            routeAnnotation = new CSRouteAnnotation(routing.PointsList);
                                            mapView.AddAnnotation(routeAnnotation);

                                            var region = routeAnnotation.Region;

                                            region.Span = new MKCoordinateSpan(region.Span.LatitudeDelta * 1.1f, region.Span.LongitudeDelta * 1.1f);


                                            mapView.SetRegion(region, true);


                                            //need to animate the distance etc here.


                                            ShowDistanceView(routing.DistanceForDisplay, routing.TimeForDisplay);

                                            BikeLocation.LogRoute();
                                        }
                                        else
                                        {
                                            alert = new UIAlertView("No route found", "Sorry, no route could be found or the route is too long.", null, "Ok");
                                            alert.Show();
                                        }
                                    });
                                });
                            }
                        });
                    }
                }
            });

            //NavigationController.NavigationBar.TintColor = Resources.DarkBlue;
            gpsButton = new UIBarButtonItem(Resources.Gps, UIBarButtonItemStyle.Bordered, delegate {
                if (!CLLocationManager.LocationServicesEnabled)
                {
                    alert = new UIAlertView("No Location Available", "Sorry, no location services are available. However, you may still be able to use the timer and map.", null, "Ok");
                    alert.Show();
                    return;
                }

                if (mapView.UserLocation != null)
                {
                    if (mapView.UserLocation.Location != null)
                    {
                        //NavigationItem.RightBarButtonItem = activityButton;

                        BikeLocation.UpdateFromWebsite(delegate {
                            InvokeOnMainThread(delegate {
                                RefreshPinColours();
                                //NavigationItem.RightBarButtonItem = gpsButton;
                            });
                        });

                        CLLocationCoordinate2D location = mapView.UserLocation.Location.Coordinate;
#if DEBUG
                        location = Locations.BanksideMix;
#endif
                        MKCoordinateRegion region = new MKCoordinateRegion(location, new MKCoordinateSpan(0.01, 0.01));

                        region = mapView.RegionThatFits(region);
                        mapView.SetRegion(region, true);
                    }
                }
            });


            NavigationItem.RightBarButtonItem = gpsButton;
        }
        public void FocusOnLocation(BikeLocation bike)
        {
            HideDistanceView();

            RemoveRouteAnnotation();

            foreach(CycleAnnotation an in mapView.Annotations)
            {
                if (an.Bike == bike)
                {

                    MKCoordinateRegion region = new MKCoordinateRegion(an.Bike.Location, new MKCoordinateSpan(0.01, 0.01));

                    region = mapView.RegionThatFits(region);

                    mapView.SetRegion(region, true);
                    mapView.SelectAnnotation(an, true);

                    mapView.ShowsUserLocation = true;
                    return;
                }
            }
        }
Exemple #21
0
 public CycleAnnotation(BikeLocation bike) : base()
 {
     Bike = bike;
 }
Exemple #22
0
        public void SetFocusOnLocation(BikeLocation bike)
        {
            UIView.BeginAnimations("foo");
            UIView.SetAnimationDuration(1);

            tabBar.SelectedIndex = 1;

            UIView.SetAnimationTransition(UIViewAnimationTransition.None, tabBar.View, true);
            UIView.CommitAnimations();
            map.FocusOnLocation(bike);
        }
        public static bool UpdateFromWebsite(NSAction onDone)
        {
            if (isUpdating)
            {
                return(false);
            }

            isUpdating = true;


            Analytics.TrackPageView("/download");
            Analytics.TrackEvent(Analytics.CATEGORY_ACTION, Analytics.ACTION_DOWNLOAD, "", 1);

            ThreadPool.QueueUserWorkItem(delegate {
                using (NSAutoreleasePool pool = new NSAutoreleasePool())
                {
                    Util.Log("updating.....");

                    if (Util.IsReachable("www.fastchicken.co.nz"))
                    {
                        //Thread.Sleep(500);

                        Util.TurnOnNetworkActivity();

                        try {
                            string s = "";
                            try
                            {
                                var wc = new WebClient();
                                //this would normally call the live service. This one is the same, but a static file
                                s = wc.DownloadString("http://www.fastchicken.co.nz/lba/docks.txt");
                            } catch (Exception ex)
                            {
                                Util.Log("Error downloading from the server.");
                                Util.Log(ex.Message);
                                return;
                            }

                            if (s == "KEY NOT VALID")
                            {
                                return;
                            }
                            string[] items = s.Split('^');

                            foreach (BikeLocation bike in AllBikes)
                            {
                                bike.Touched = false;
                            }

                            foreach (var item in items)
                            {
                                string[] bits = item.Split('|');

                                try {
                                    BikeLocation location = null;

                                    if (bikesById.ContainsKey(bits[0]))
                                    {
                                        location = bikesById[bits[0]];
                                    }
                                    else
                                    {
                                        location = new BikeLocation(bits, true);
                                        AddBike(location);
                                    }

                                    location.DocksAvailable = -1;
                                    location.IsAvailable    = bits[4].ToLower() == "true";
                                    location.DocksAvailable = Int32.Parse(bits[6]);
                                    location.Capacity       = Int32.Parse(bits[5]);
                                    if (bits.Length == 8)
                                    {
                                        location.BikesAvailable = Int32.Parse(bits[7]);
                                    }
                                    else
                                    {
                                        location.BikesAvailable = location.Capacity - location.DocksAvailable;
                                    }
                                    location.Touched = true;
                                } catch
                                {
                                    //do nothing
                                }
                            }


                            List <BikeLocation> DocksToRemove = new List <BikeLocation>();
                            foreach (BikeLocation bike in AllBikes)
                            {
                                if (!bike.Touched)
                                {
                                    Util.Log("Found untouched bike: {0}", bike.Name);
                                    DocksToRemove.Add(bike);
                                }
                            }

                            foreach (BikeLocation bike in DocksToRemove)
                            {
                                RemoveBike(bike);
                            }



                            WriteToPersistentFile();



                            Util.Log("updated");
                        } finally {
                            Util.TurnOffNetworkActivity();
                            isUpdating = false;
                        }
                        if (onDone != null)
                        {
                            onDone();
                        }
                    }
                    else
                    {
                        Util.Log("No network or website not reachable");
                    }
                }
            });

            return(true);
        }