protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (watcher == null) { watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.Default); watcher.MovementThreshold = 20; watcher.PositionChanged += new EventHandler <GeoPositionChangedEventArgs <GeoCoordinate> >(watcher_PositionChanged); watcher.StatusChanged += new EventHandler <GeoPositionStatusChangedEventArgs>(watcher_StatusChanged); } watcher.Start(); if (!vm.IsLoad) { vm.Load(false, App.lat, App.lon, App.alt); if (App.MasterSpaceObjects.IsLoad) { vm.Load(App.MasterSpaceObjects); } else { vm.Load(false, App.lat, App.lon, App.alt); } } }
//private void AcquirePushChannel() //{ // CurrentChannel = HttpNotificationChannel.Find("MyPushChannel"); // try // { // if (CurrentChannel == null) // { // CurrentChannel = new HttpNotificationChannel("MyPushChannel"); // CurrentChannel.Open(); // CurrentChannel.BindToShellTile(); // } // //else { // // CurrentChannel.Open(); // //} // //IMobileServiceTable<Channel> channelTable = App.MobileService.GetTable<Channel>(); // var channel = new Channel { Uri = CurrentChannel.ChannelUri.ToString() }; // // channelTable.InsertAsync(channel); // } // catch (Exception ex) // { // } //} // Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { MasterSpaceObjects.Load(false); //AcquirePushChannel(); }