Ejemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            WaypointListItem wpi = listBox1.SelectedItem as WaypointListItem;

            Framework.Data.Location ll = Utils.Conversion.StringToLocation(textBox8.Text);
            if (Core.ActiveGeocache != null && wpi != null && wpi.WP.ID <= 0)
            {
                if (Utils.API.GeocachingLiveV6.CheckAPIAccessAvailable(Core, true))
                {
                    try
                    {
                        Utils.API.LiveV6.SaveUserWaypointResponse resp = null;
                        Cursor = Cursors.WaitCursor;
                        try
                        {
                            using (Utils.API.GeocachingLiveV6 api = new Utils.API.GeocachingLiveV6(Core))
                            {
                                var req = new Utils.API.LiveV6.SaveUserWaypointRequest();
                                req.AccessToken = api.Token;
                                req.CacheCode   = Core.ActiveGeocache.Code;
                                req.Description = textBox2.Text;
                                req.Latitude    = ll.Lat;
                                req.Longitude   = ll.Lon;
                                resp            = api.Client.SaveUserWaypoint(req);
                            }
                        }
                        finally
                        {
                            Cursor = Cursors.Default;
                        }
                        if (resp != null)
                        {
                            if (resp.Status.StatusCode == 0)
                            {
                                Framework.Data.UserWaypoint wp = Utils.API.Convert.UserWaypoint(Core, resp.NewWaypoint);
                                wp.Saved = false;
                                wpi.WP   = wp;
                                Core.UserWaypoints.Add(wp);
                            }
                            else
                            {
                                MessageBox.Show(resp.Status.StatusMessage ?? "", Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
                            }
                        }
                        else
                        {
                            MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_FAILED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
                        }
                    }
                    catch
                    {
                        MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_FAILED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override bool Action(string action)
        {
            bool result = base.Action(action);

            if (result && action == ACTION_SHOW)
            {
                if (Utils.API.GeocachingLiveV6.CheckAPIAccessAvailable(Core, true))
                {
                    using (var client = new Utils.API.GeocachingLiveV6(Core, true))
                    {
                        var res = client.Client.GetUserWaypoints(client.Token, "GC2CHT2");
                        if (res.Status.StatusCode == 0)
                        {
                        }
                        ///*
                        var req = new Utils.API.LiveV6.SaveUserWaypointRequest();
                        req.AccessToken = client.Token;
                        req.CacheCode   = "GC2CHT2";
                        req.Description = "Coordinate Override";
                        var ll = Utils.Conversion.StringToLocation("N 52° 14.431 E 005° 56.159");
                        req.Latitude  = ll.Lat;
                        req.Longitude = ll.Lon;
                        var res2 = client.Client.SaveUserWaypoint(req);

                        if (res2.Status.StatusCode == 0)
                        {
                        }

                        res = client.Client.GetUserWaypoints(client.Token, "GC2CHT2");
                        if (res.Status.StatusCode == 0)
                        {
                        }
                        //* */
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        public override bool Action(string action)
        {
            bool result = base.Action(action);
            if (result && action == ACTION_SHOW)
            {
                if (Utils.API.GeocachingLiveV6.CheckAPIAccessAvailable(Core, true))
                {
                    using (var client = new Utils.API.GeocachingLiveV6(Core, true))
                    {
                        var res = client.Client.GetUserWaypoints(client.Token, "GC2CHT2");
                        if (res.Status.StatusCode == 0)
                        {
                        }
                        ///*
                        var req = new Utils.API.LiveV6.SaveUserWaypointRequest();
                        req.AccessToken = client.Token;
                        req.CacheCode = "GC2CHT2";
                        req.Description = "Coordinate Override";
                        var ll = Utils.Conversion.StringToLocation("N 52° 14.431 E 005° 56.159");
                        req.Latitude = ll.Lat;
                        req.Longitude = ll.Lon;
                        var res2 = client.Client.SaveUserWaypoint(req);

                        if (res2.Status.StatusCode == 0)
                        {
                        }

                        res = client.Client.GetUserWaypoints(client.Token, "GC2CHT2");
                        if (res.Status.StatusCode == 0)
                        {
                        }
                         //* */
                    }
                }
            }
            return result;
        }
Ejemplo n.º 4
0
 private void button4_Click(object sender, EventArgs e)
 {
     WaypointListItem wpi = listBox1.SelectedItem as WaypointListItem;
     Framework.Data.Location ll = Utils.Conversion.StringToLocation(textBox8.Text);
     if (Core.ActiveGeocache!=null && wpi != null && wpi.WP.ID <= 0)
     {
         if (Utils.API.GeocachingLiveV6.CheckAPIAccessAvailable(Core, true))
         {
             try
             {
                 Utils.API.LiveV6.SaveUserWaypointResponse resp = null;
                 Cursor = Cursors.WaitCursor;
                 try
                 {
                     using (Utils.API.GeocachingLiveV6 api = new Utils.API.GeocachingLiveV6(Core))
                     {
                         var req = new Utils.API.LiveV6.SaveUserWaypointRequest();
                         req.AccessToken = api.Token;
                         req.CacheCode = Core.ActiveGeocache.Code;
                         req.Description = textBox2.Text;
                         req.Latitude = ll.Lat;
                         req.Longitude = ll.Lon;
                         resp = api.Client.SaveUserWaypoint(req);
                     }
                 }
                 finally
                 {
                     Cursor = Cursors.Default;
                 }
                 if (resp != null)
                 {
                     if (resp.Status.StatusCode == 0)
                     {
                         Framework.Data.UserWaypoint wp = Utils.API.Convert.UserWaypoint(Core, resp.NewWaypoint);
                         wp.Saved = false;
                         wpi.WP = wp;
                         Core.UserWaypoints.Add(wp);
                     }
                     else
                     {
                         MessageBox.Show(resp.Status.StatusMessage ?? "", Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
                     }
                 }
                 else
                 {
                     MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_FAILED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
                 }
             }
             catch
             {
                 MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_FAILED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR));
             }
         }
     }
 }