Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            _loadDataButton = UIButton.FromType(UIButtonType.RoundedRect);
            _loadDataButton.SetTitle("Hent sanntidsdata", UIControlState.Normal);
            _loadDataButton.Frame = new RectangleF(10, 10, View.Bounds.Width - 20, 50);

            _result = new UITextView(new RectangleF(10, 70, View.Bounds.Width - 20, View.Bounds.Height - 80));
            _result.Font = UIFont.FromName("Arial", 14);
            _result.Editable = false;

            _activityIndicator = new UIActivityIndicatorView(new RectangleF(View.Bounds.Width / 2 - 20, View.Bounds.Height / 2 - 20, 40, 40));
            _activityIndicator.AutoresizingMask = UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleRightMargin;
            _activityIndicator.ActivityIndicatorViewStyle = UIActivityIndicatorViewStyle.WhiteLarge;

            View.AddSubview(_activityIndicator);
            View.AddSubview(_loadDataButton);
            View.AddSubview(_result);

            View.BackgroundColor = UIColor.DarkGray;

            _loadDataButton.TouchUpInside += delegate(object sender, EventArgs e) {
                if(_location != null)
                {
                    _activityIndicator.StartAnimating();
                    _result.Text = "Jobber..." + Environment.NewLine + Environment.NewLine;
                    var coordinate = new GeographicCoordinate(_location.Latitude, _location.Longtitude);
                    ThreadPool.QueueUserWorkItem(o => _sanntid.GetNearbyStops(coordinate, BusStopsLoaded));
                }
            };

            _gpsService.LocationChanged = location => _location = location;
            _gpsService.Start();
        }
Exemple #2
0
 private void TimerEvent()
 {
     if(_running)
     {
         var loc = new LocationData(63.425630295, 10.4458852325, 0, 1, DateTime.Now);
         if(LocationChanged != null)
         {
             LocationChanged(loc);
         }
     }
 }
Exemple #3
0
 private void TimerEvent()
 {
     if(_running)
     {
         var loc = new LocationData(_latitude, _longtitude, 0, 1, DateTime.Now);
         if(LocationChanged != null)
         {
             LocationChanged(loc);
         }
         _latitude += 0.000001;
         _longtitude += 0.000001;
     }
 }
Exemple #4
0
 private void LocationChanged(LocationData location)
 {
     _location = location;
 }