コード例 #1
0
        private void Invoke()
        {
            //string apicall = @"http://api.geonames.org/findNearbyWikipediaJSON?postalcode=33702&country=US&radius=10&username=demo";
            //m_msghelper.msg("invoking against " + apicall);
            //api_findNearbyPlaces.Invoke<APIMASH_WikiPediaLib.APIMASH_OM>(apicall);
            m_msghelper.clr();

            string _username = APIMASHGlobals.Instance.UserID;

            if (_username.Length <= 0)
            {
                MessageDialogHelper.ShowMsg("username", "valid geonames username is required to be set, use the CHARMS=>SETTINGS menu to enter yours");
                return;
            }

            int _zip = 0;

            try
            {
                _zip = System.Convert.ToInt32(TextBox_SearchFor.Text);
            }
            catch
            {
                MessageDialogHelper.ShowMsg("oops", "postalcode must be all numeric");
                return;
            }

            FindNearbyWikipediaHelper _apihelper = new FindNearbyWikipediaHelper(_zip, "US", 10, _username);
            string _apicall = _apihelper.TargetURL;

            System.Diagnostics.Debug.WriteLine("TargetURL=" + _apicall);

            m_msghelper.msg("invoking against " + _apicall);
            api_findNearbyPlaces.Invoke <APIMASH_WikiPediaLib.APIMASH_OM>(_apicall);
        }
コード例 #2
0
        void api_findNearbyPlaces_OnResponse(object sender, APIMASHLib.APIMASHEvent e)
        {
            APIMASH_WikiPediaLib.APIMASH_OM _response = (APIMASH_WikiPediaLib.APIMASH_OM)e.Object;
            if (e.Status == APIMASHLib.APIMASHStatus.SUCCESS)
            {
                // copy data into bindable format for UI
                // not really using right now but it works
                _nearbyplaces.Copy(_response);

                if (_response.geonames == null)
                {
                    m_msghelper.msg("NO RESULTS RETURNED");
                    return;
                }

                m_msghelper.msg(string.Format("{0} geonames returned", _response.geonames.Count()));
                int _count = 1;
                foreach (APIMASH_WikiPediaLib.geoname gn in _response.geonames)
                {
                    m_msghelper.msg(string.Format("{0}:  {1}", _count.ToString(), gn.ToNearbyPlaceString()));
                    _count++;
                }
            }
            else
            {
                MessageDialogHelper.ShowMsg("oops", e.Message);
            }
        }
コード例 #3
0
        private void Invoke()
        {
            string _username = APIMASHGlobals.Instance.UserID;

            if (_username.Length <= 0)
            {
                MessageDialogHelper.ShowMsg("username", "valid geonames username is required to be set, use the CHARMS=>SETTINGS menu to enter yours");
                return;
            }

            WikipediaSearchHelper _apihelper = new WikipediaSearchHelper(_username, "Orlando", 50);

            string _apicall = _apihelper.TargetURL;

            System.Diagnostics.Debug.WriteLine("TargetURL=" + _apicall);

            m_msghelper.msg("invoking against " + _apicall);
            m_api_wikipediaSearch.Invoke <APIMASH_WikiPediaLib.APIMASH_OM>(_apicall);
        }
コード例 #4
0
        private void Invoke()
        {
            //string apicall = @"http://api.geonames.org/wikipediaBoundingBoxJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&username=devfish";
            string _username = APIMASHGlobals.Instance.UserID;

            if (_username.Length <= 0)
            {
                MessageDialogHelper.ShowMsg("username", "valid geonames username is required to be set, use the CHARMS=>SETTINGS menu to enter yours");
                return;
            }

            WikipediaBoundingBoxHelper _apihelper = new WikipediaBoundingBoxHelper(_username, 44.2, -10, -22.5, 55.3);

            string _apicall = _apihelper.TargetURL;

            System.Diagnostics.Debug.WriteLine("TargetURL=" + _apicall);

            m_msghelper.msg("invoking against " + _apicall);
            api_findNearbyPlaces.Invoke <APIMASH_WikiPediaLib.APIMASH_OM>(_apicall);
        }
コード例 #5
0
        private void Invoke()
        {
            m_msghelper.clr();
            m_msghelper.msg(System.DateTime.Now.ToString() + " : " + "Invoke()");

            //string apicall = @"http://api.geonames.org/wikipediaBoundingBoxJSON?north=44.1&south=-9.9&east=-22.4&west=55.2&username=devfish";
            string _username = APIMASHGlobals.Instance.UserID;

            if (_username.Length <= 0)
            {
                MessageDialogHelper.ShowMsg("username", "valid geonames username is required to be set, use the CHARMS=>SETTINGS menu to enter yours");
                return;
            }

            double _latUL = 0.0;
            double _lonUL = 0.0;
            double _lonLR = 0.0;
            double _latLR = 0.0;

            try
            {
                _latUL = System.Convert.ToDouble(TextBox_LatUL.Text);
                _lonUL = System.Convert.ToDouble(TextBox_LonUL.Text);
                _latLR = System.Convert.ToDouble(TextBox_LatLR.Text);
                _lonLR = System.Convert.ToDouble(TextBox_LonLR.Text);
            }
            catch
            {
                m_msghelper.msg("one of the latlon pairs is in invalid format");
                return;
            }

            WikipediaBoundingBoxHelper _apihelper = new WikipediaBoundingBoxHelper(_username, _latUL, _latLR, _lonUL, _lonLR);

            string _apicall = _apihelper.TargetURL;

            System.Diagnostics.Debug.WriteLine("TargetURL=" + _apicall);

            m_msghelper.msg("invoking against " + _apicall);
            api_findNearbyPlaces.Invoke <APIMASH_WikiPediaLib.APIMASH_OM>(_apicall);
        }