예제 #1
0
 void DoLocationReady(GeoCoord Location, LocationManager.LocationSource Source)
 {
     try
     {
         if (InvokeRequired)
         {
             LocationManager.delLocationReady d = new LocationManager.delLocationReady(DoLocationReady);
             BeginInvoke(d, Location, Source);
         }
         else
         {
             GPSLocation = Location;
             lblGPS.Text = PockeTwit.Localization.XmlBasedResourceManager.GetString("Location Found");
             lblGPS.Text += " (" + Source.ToString() + ")";
             if (DetectDevice.DeviceType == DeviceType.Standard)
             {
                 // just enable the menuItem
                 if (null != menuGPSInsert)
                 {
                     menuGPSInsert.Enabled = true;
                 }
             }
             else
             {
                 picInsertGPSLink.Visible = true;
             }
             Place selP = null; // currently selected place, if any
             if (cmbPlaces.SelectedItem is Place)
             {
                 selP = cmbPlaces.SelectedItem as Place;
             }
             cmbPlaces.Items.Clear();
             cmbPlaces.Visible = true;
             cmbPlaces.Items.Add(GPSLocation);
             cmbPlaces.SelectedIndex = 0;
             if (places != null)
             {
                 foreach (Place p in places)
                     cmbPlaces.Items.Add(p);
             }
             foreach (object item in cmbPlaces.Items)
             {
                 if (item is Place)
                 {
                     Place p = item as Place;
                     if (p.Equals(selP))
                     {
                         cmbPlaces.SelectedItem = p;
                         break;
                     }
                 }
             }
             if (cmbPlaces.SelectedItem is GeoCoord && selP != null) // not selected a place
             {
                 cmbPlaces.Items.Add(selP);
                 cmbPlaces.SelectedItem = selP;
             }
         }
     }
     catch (ObjectDisposedException)
     {
     }
 }
예제 #2
0
 void l_LocationReady(GeoCoord Location, LocationManager.LocationSource Source)
 {
     // We're in a separate thread, probably - grab the places from Twitter
     if (Location != null)
     {
         if (GPSLocation != null && Source == LocationManager.LocationSource.RIL)
             return; // if we've got a location and RIL gives another one, ignore it
         Twitter Conn = Servers.CreateConnection(AccountToSet);
         if (Conn is PlaceAPI)
         {
             PlaceAPI PlaceSearch = Conn as PlaceAPI;
             places = PlaceSearch.GetNearbyPlaces(Location);
         }
         DoLocationReady(Location, Source);
     }
 }
예제 #3
0
 void Locator_LocationReady(GeoCoord Location, LocationManager.LocationSource Source)
 {
     GPSLocation = Location;
     GPSLocked();
 }