Пример #1
0
        /// <summary>
        ///  if (isset($_GET['lat']) && isset($_GET['lon']) && isset($_GET['token'])) {
        /// </summary>
        public async Task <List <Nearest> > Search(string who)
        {
            HttpClient client = new HttpClient();

            string server = UserSingleton.server;

            server += "api.php?action=" + Action.ntm_search.ToString();
            server += "&who=" + who;

            List <Nearest> ret = new List <Nearest>();

            try
            {
                string res = await client.GetStringAsync(server);

                ResponseApi result = ResponseApi.GetResponseApiFrom(res);

                if (result.isSuccess())
                {
                    ret = result.results;
                }
                else
                {
                    main.MessageBox(result.ToString());
                }
            }
            catch
            {
                main.MessageBox("Serveur ne Repond pas");
            }
            return(ret);
        }
Пример #2
0
        /// <summary>
        ///     if (isset($_GET['token']) && isset($_GET['lat']) && isset($_GET['lon'])) {
        /// </summary>
        public async void Update()
        {
            HttpClient client = new HttpClient();

            string server = UserSingleton.server;

            server += "api.php?action=" + Action.ntm_update.ToString();
            server += "&token=" + Token + "&lat=" + Latitude + "&lon=" + Longitude;

            string res = await client.GetStringAsync(server);

            ResponseApi result = ResponseApi.GetResponseApiFrom(res);

            if (result.isSuccess())
            {
                main.MessageBox("Position Updated  to (" + Latitude + ", " + Longitude + ")");
            }
            else
            {
                main.MessageBox(result.ToString());
            }
        }