public override bool Action(string action) { bool result = base.Action(action); if (result && action == ACTION_SHOW) { try { using (var api = new Utils.API.GeocachingLiveV6(Core)) { var req = new Utils.API.LiveV6.GetAnotherUsersProfileRequest(); req.AccessToken = api.Token; req.UserID = 164977; req.ProfileOptions = new Utils.API.LiveV6.UserProfileOptions(); req.ProfileOptions.PublicProfileData = true; var p = api.Client.GetAnotherUsersProfile(req); } } catch(Exception e) { } } return result; }
public override bool Action(string action) { bool result = base.Action(action); if (result && action == ACTION_SHOW) { try { using (var api = new Utils.API.GeocachingLiveV6(Core)) { var req = new Utils.API.LiveV6.GetAnotherUsersProfileRequest(); req.AccessToken = api.Token; req.UserID = 164977; req.ProfileOptions = new Utils.API.LiveV6.UserProfileOptions(); req.ProfileOptions.PublicProfileData = true; var p = api.Client.GetAnotherUsersProfile(req); } } catch (Exception e) { } } return(result); }
private void pickRandomGeocacheMethod() { Random rnd = new Random(); Framework.Data.Geocache gc = null; while (true) { if (_checkTrigger.WaitOne()) { try { string loggerAvatar = null; gc = null; if (Properties.Settings.Default.SelectedGeocachesOnly) { List<Framework.Data.Geocache> gcList = Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches); if (gcList.Count > 2) { //just pick a random one int index = rnd.Next(gcList.Count - 1); gc = gcList[index]; } } else if (Core.Geocaches.Count > 2) { //just pick a random one int index = rnd.Next(Core.Geocaches.Count - 1); gc = (Framework.Data.Geocache)Core.Geocaches[index]; } if (gc != null) { Framework.Data.Log log = Utils.DataAccess.GetLogs(Core.Logs, gc.Code).FirstOrDefault(); if (Properties.Settings.Default.GetLoggerAvatar && log != null && !string.IsNullOrEmpty(Core.GeocachingComAccount.APIToken)) { try { using (Utils.API.GeocachingLiveV6 client = new Utils.API.GeocachingLiveV6(Core, string.IsNullOrEmpty(Core.GeocachingComAccount.APIToken))) { var req = new Utils.API.LiveV6.GetAnotherUsersProfileRequest(); req.AccessToken = client.Token; req.ProfileOptions = new Utils.API.LiveV6.UserProfileOptions(); req.ProfileOptions.PublicProfileData = true; if (log != null) { if (log.FinderId.StartsWith("G")) { req.UserID = Utils.Conversion.GetCacheIDFromCacheCode(log.FinderId); } else { req.UserID = int.Parse(log.FinderId); } } var resp = client.Client.GetAnotherUsersProfile(req); if (resp != null && resp.Status.StatusCode == 0) { loggerAvatar = resp.Profile.User.AvatarUrl; } } } catch { } } _context.Send(new SendOrPostCallback(delegate(object state) { try { if (!this.IsDisposed && this.Visible) { Core.ActiveGeocache = gc; label1.Text = DateTime.Now.ToString(); linkLabelGC.Links.Clear(); pictureBoxGC.ImageLocation = Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Default, gc.GeocacheType); linkLabelGC.Text = string.Format("{0}, {1}", gc.Code, gc.Name); linkLabelGC.Links.Add(0, gc.Code.Length, gc.Url); if (!string.IsNullOrEmpty(loggerAvatar)) { pictureBox1.Visible = true; pictureBox1.ImageLocation = loggerAvatar; } else { pictureBox1.Visible = false; } if (log != null) { label1.Text = log.Date.ToLongDateString(); label3.Text = log.Finder ?? ""; label5.Text = log.Text ?? ""; } else { label3.Text = ""; label5.Text = ""; } } } catch { } }), null); } } catch { } } } }
private void pickRandomGeocacheMethod() { Random rnd = new Random(); Framework.Data.Geocache gc = null; while (true) { if (_checkTrigger.WaitOne()) { try { string loggerAvatar = null; gc = null; if (Properties.Settings.Default.SelectedGeocachesOnly) { List <Framework.Data.Geocache> gcList = Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches); if (gcList.Count > 2) { //just pick a random one int index = rnd.Next(gcList.Count - 1); gc = gcList[index]; } } else if (Core.Geocaches.Count > 2) { //just pick a random one int index = rnd.Next(Core.Geocaches.Count - 1); gc = (Framework.Data.Geocache)Core.Geocaches[index]; } if (gc != null) { Framework.Data.Log log = Utils.DataAccess.GetLogs(Core.Logs, gc.Code).FirstOrDefault(); if (Properties.Settings.Default.GetLoggerAvatar && log != null && !string.IsNullOrEmpty(Core.GeocachingComAccount.APIToken)) { try { using (Utils.API.GeocachingLiveV6 client = new Utils.API.GeocachingLiveV6(Core, string.IsNullOrEmpty(Core.GeocachingComAccount.APIToken))) { var req = new Utils.API.LiveV6.GetAnotherUsersProfileRequest(); req.AccessToken = client.Token; req.ProfileOptions = new Utils.API.LiveV6.UserProfileOptions(); req.ProfileOptions.PublicProfileData = true; if (log != null) { if (log.FinderId.StartsWith("G")) { req.UserID = Utils.Conversion.GetCacheIDFromCacheCode(log.FinderId); } else { req.UserID = int.Parse(log.FinderId); } } var resp = client.Client.GetAnotherUsersProfile(req); if (resp != null && resp.Status.StatusCode == 0) { loggerAvatar = resp.Profile.User.AvatarUrl; } } } catch { } } _context.Send(new SendOrPostCallback(delegate(object state) { try { if (!this.IsDisposed && this.Visible) { Core.ActiveGeocache = gc; label1.Text = DateTime.Now.ToString(); linkLabelGC.Links.Clear(); pictureBoxGC.ImageLocation = Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Default, gc.GeocacheType); linkLabelGC.Text = string.Format("{0}, {1}", gc.Code, gc.Name); linkLabelGC.Links.Add(0, gc.Code.Length, gc.Url); if (!string.IsNullOrEmpty(loggerAvatar)) { pictureBox1.Visible = true; pictureBox1.ImageLocation = loggerAvatar; } else { pictureBox1.Visible = false; } if (log != null) { label1.Text = log.Date.ToLongDateString(); label3.Text = log.Finder ?? ""; label5.Text = log.Text ?? ""; } else { label3.Text = ""; label5.Text = ""; } } } catch { } }), null); } } catch { } } } }