コード例 #1
0
        public CurrentTripView()
        {
            InitializeComponent();
            ViewModel = new CurrentTripViewModel();
            Locations = new List<BasicGeoposition>();

            if (Logger.BingMapsAPIKey != "____BingMapsAPIKey____")
            {
                MyMap.MapServiceToken = Logger.BingMapsAPIKey;
            }

            MyMap.Loaded += MyMap_Loaded;
            DataContext = this;
            recordButtonImage = new BitmapImage(new Uri("ms-appx:///Assets/StartRecord.png", UriKind.Absolute));
            OnPropertyChanged(nameof(RecordButtonImage));
            StartRecordBtn.Click += StartRecordBtn_Click;       
        }
コード例 #2
0
        public override StartCommandResult OnStartCommand(Intent intent, StartCommandFlags flags, int startId)
        {
            var builder = new NotificationCompat.Builder(this);

            var newIntent = new Intent(this, typeof (MainActivity));
            newIntent.PutExtra("tracking", true);
            newIntent.AddFlags(ActivityFlags.ClearTop);
            newIntent.AddFlags(ActivityFlags.SingleTop);

            var pendingIntent = PendingIntent.GetActivity(this, 0, newIntent, 0);
            var notification = builder.SetContentIntent(pendingIntent)
                .SetSmallIcon(Resource.Drawable.ic_notification)
                .SetAutoCancel(false)
                .SetTicker("MyDriving is recording.")
                .SetContentTitle("MyDriving")
                .SetContentText("MyDriving is recording your current trip.")
                .Build();


            StartForeground((int) NotificationFlags.ForegroundService, notification);

            ViewModel = new CurrentTripViewModel();
            return StartCommandResult.Sticky;
        }
コード例 #3
0
        async Task ConfigureCurrentTripUserInterface()
        {
            // Configure map
            mapDelegate = new TripMapViewDelegate(true);
            tripMapView.Delegate = mapDelegate;
            tripMapView.ShowsUserLocation = false;
            tripMapView.Camera.Altitude = 5000;

			// Setup record button
			recordButton.Hidden = false;
            recordButton.Layer.CornerRadius = recordButton.Frame.Width/2;
            recordButton.Layer.MasksToBounds = true;
            recordButton.Layer.BorderColor = UIColor.White.CGColor;
            recordButton.Layer.BorderWidth = 0;
            recordButton.TouchUpInside += RecordButton_TouchUpInside;

            // Hide slider
            tripSlider.Hidden = true;
            wayPointA.Hidden = true;
            wayPointB.Hidden = true;

            UpdateRecordButton(false);
            tripInfoView.Alpha = 0;
            ResetTripInfoView();

            CurrentTripViewModel = new CurrentTripViewModel();
            CurrentTripViewModel.Geolocator.PositionChanged += Geolocator_PositionChanged;
        }
コード例 #4
0
 void OnLocationServiceConnected(object sender, ServiceConnectedEventArgs e)
 {
     viewModel = GeolocationHelper.Current.LocationService.ViewModel;
     viewModel.PropertyChanged += OnPropertyChanged;
     ResetTrip();
 }