protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            LocationManager locationManager = (LocationManager)GetSystemService(LocationService);

            location = new Geolocation(locationManager);
            //
            // Get our button from the layout resource,
            // and attach an event to it
            Button getLocationButton = FindViewById <Button>(Resource.Id.GetLocationButton);

            watchButton = FindViewById <Button>(Resource.Id.WatchButton);

            locationTextView = FindViewById <TextView>(Resource.Id.LocationTextView);

            getLocationButton.Click += delegate
            {
                LogDeviceInfo();
                GetCurrentPosition();
            };

            watchButton.Click += delegate { ToggleWatch(); };
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			
			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

		    LocationManager locationManager=(LocationManager) GetSystemService(LocationService);
            
		    location = new Geolocation(locationManager);
		    //
			// Get our button from the layout resource,
			// and attach an event to it
            Button getLocationButton = FindViewById<Button>(Resource.Id.GetLocationButton);
            
		    watchButton = FindViewById<Button>(Resource.Id.WatchButton);

		    locationTextView = FindViewById<TextView>(Resource.Id.LocationTextView);

		    getLocationButton.Click += delegate
			                    {
			                        LogDeviceInfo();
			                        GetCurrentPosition();
			                    };

		    watchButton.Click += delegate { ToggleWatch(); };
		}
예제 #3
0
        public NearestAirportService(IGeolocation locationService, ITinyMessengerHub messenger)
        {
            _locationService = locationService;
            _messenger       = messenger;

            _airportsService = new AirportNamesService();
            _messenger.Subscribe <FindNearestAirportMessage>(m => FindNearestAirport());
        }
예제 #4
0
파일: Ipapi.cs 프로젝트: kthode/Ryuko
        public async Task <IGeolocationProvider> RefetchAsync(CancellationToken token = default)
        {
            using (var client = new HttpClient())
            {
                var resp = await client.GetAsync("http://ip-api.com/json");

                var json = await resp.Content.ReadAsStringAsync();

                var info = JsonConvert.DeserializeObject <GeolocationInfo>(json);

                this._json = json;
                this._info = info;
                return(this);
            }
        }
예제 #5
0
        public MainViewModel(IDialogService dialog, INavigationService nav, IGeolocation geo)
        {
            diaService = dialog;
            navService = nav;
            geoService = geo;

            PropertyChanged += (sender, e) =>
            {
                if (e.PropertyName == "Location")
                {
                    var posn = geoService.GetLocationData();
                    Longitude = posn.Longitude;
                    Latitude  = posn.Latitude;
                    Altitude  = posn.Altitude;
                    Speed     = posn.Speed;
                    Heading   = posn.Heading;
                }
            };
        }
        public ClockPageViewModel(IPageNavigator pageNavigator,
                                  ILogger logger,
                                  IUserDialogs userDialogs,
                                  IRequestExceptionHandler requestExceptionHandler,
                                  IEventAggregator eventAggregator,
                                  ILocationManager locationManager,
                                  IGeolocation geolocation,
                                  IAppUserManager appUserManager,
                                  IEmployeeManager employeeManager,
                                  IAttendanceLogManager attendanceLogManager) : base(pageNavigator, logger, userDialogs, requestExceptionHandler, eventAggregator)
        {
            _locationManager      = locationManager;
            _geolocation          = geolocation;
            _appUserManager       = appUserManager;
            _employeeManager      = employeeManager;
            _attendanceLogManager = attendanceLogManager;

            BackCommand   = new DelegateCommand(async() => await PageNavigator.GoBackAsync());
            SubmitCommand = new DelegateCommand(async() => await OnSubmit(), () => OnSubmitCanExecute()).ObservesProperty(() => CurrentPostion).ObservesProperty(() => CurrentLocationName);

            _mapDragPinNewLocationEventToken = EventAggregator.GetEvent <MapDragPinNewLocationEvent>().Subscribe(async(pos) => await SetPoint(pos.Latitude, pos.Longitude));

            Geofences = new ObservableCollection <Circle>();
        }
예제 #7
0
 protected override UnitedStates MappingTo(IGeolocation geolocation)
 {
     this.City = geolocation.RegionName;
     return(this);
 }
예제 #8
0
 public static TMapping Mapping <TMapping>(this IGeolocation geolocation)
     where TMapping : ISelfMapping <TMapping>, new()
 {
     return(new TMapping().MappingTo(geolocation));
 }
예제 #9
0
파일: SelfMapping.cs 프로젝트: kthode/Ryuko
 protected abstract T MappingTo(IGeolocation geolocation);
예제 #10
0
파일: SelfMapping.cs 프로젝트: kthode/Ryuko
 T ISelfMapping <T> .MappingTo(IGeolocation geolocation) => this.MappingTo(geolocation);
 /**
  * Set the delegate implementation.
  *
  * @param _delegate The delegate implementing platform specific functions.
  */
 public void SetDelegate(IGeolocation _delegate)
 {
     this._delegate = _delegate;
 }
 /**
  * Constructor with delegate.
  *
  * @param _delegate The delegate implementing platform specific functions.
  */
 public GeolocationBridge(IGeolocation _delegate) : base()
 {
     this._delegate = _delegate;
 }
예제 #13
0
 public Weather(IConnectivity connectivity, IService service, IGeolocation geolocation)
 {
     _connectivity = connectivity;
     _service      = service;
     _geolocation  = geolocation;
 }
예제 #14
0
 public MapViewModel(INavigationService navigationService, IDataStore <Business> businessStore, IGeolocation geolocation) : base(navigationService)
 {
     BusinessStore = businessStore;
     Geolocation   = geolocation;
 }
예제 #15
0
 public GeolocationService(IGeolocation geolocation)
 {
     _geolocation = geolocation;
 }
예제 #16
0
 public static Task <Location?> GetLocationAsync(this IGeolocation geolocation, GeolocationRequest request) =>
 geolocation.GetLocationAsync(request ?? new GeolocationRequest(), default);
예제 #17
0
 public SplashScreenPageViewModel(INavigationService navigationService, IGeolocation geolocation, IPageDialogService pageDialogService)
     : base(navigationService, pageDialogService)
 {
     _geolocation = geolocation;
 }