Example #1
0
 public static bool Authorize(Framework.Interfaces.ICore core, bool syncAll)
 {
     bool result = false;
     try
     {
         if (core.RetrieveAPIKey(Framework.Data.APIKey.GeocachingLive))
         {
             using (GeocachingLiveV6 client = new GeocachingLiveV6(core))
             {
                 LiveV6.GetUserProfileResponse resp = client.Client.GetYourUserProfile(new LiveV6.GetYourUserProfileRequest()
                 {
                     AccessToken = client.Token,
                     DeviceInfo = new LiveV6.DeviceData()
                     {
                         DeviceName = "GlobalcachingApplication",
                         DeviceUniqueId = "internal",
                         ApplicationSoftwareVersion = "V1.0.0.0"
                     }
                 });
                 if (resp.Status.StatusCode == 0)
                 {
                     result = true;
                     core.GeocachingComAccount.AccountName = resp.Profile.User.UserName;
                     core.GeocachingComAccount.MemberType = resp.Profile.User.MemberType.MemberTypeName;
                     core.GeocachingComAccount.MemberTypeId = (int)resp.Profile.User.MemberType.MemberTypeId;
                     if (syncAll)
                     {
                         if (resp.Profile.User.HomeCoordinates != null)
                         {
                             core.HomeLocation.SetLocation(resp.Profile.User.HomeCoordinates.Latitude, resp.Profile.User.HomeCoordinates.Longitude);
                         }
                     }
                 }
                 else
                 {
                 }
             }
         }
     }
     catch
     {
     }
     return result;
 }