示例#1
0
        async void OnRegisterAtCurrentLocation(object s, RoutedEventArgs e)
        {
            // We register a 1km fence where the user has to dwell for 30 seconds before
            // we expect to get notified that they have entered/exited the fence.
            await GeofenceHelper.RegisterAsync(
                1000.0d,
                MonitoredGeofenceStates.Entered | MonitoredGeofenceStates.Exited,
                TimeSpan.FromSeconds(30));

            this.UpdateStatusDependentProperties();

            GeofenceHelper.AddTaskCompletedHandler(
                this.BackgroundTaskCompletedHandler);
        }
示例#2
0
        async void OnLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            this.DataContext = this;

            await this.ReloadLogFileEntriesAsync();

            this.UpdateStatusDependentProperties();

            if (GeofenceHelper.IsRegistered)
            {
                // If we're already registered then we want to know whenever our background
                // task completes so that we can update the UI.
                GeofenceHelper.AddTaskCompletedHandler(this.BackgroundTaskCompletedHandler);
            }
        }