Ejemplo n.º 1
0
        void doUgcs(List <XMLement> ugcs)
        {
            AppController.poiHit();


            XMLement raw = XMLement.createFromRawXml("<poi><name>VolksMond</name><description>Door andere gebruikers gemaakte media</description></poi>");
            XMLement mmd = new XMLement("media");

            foreach (XMLement x in ugcs)
            {
                mmd.addChild(x);
            }

            raw.addChild(mmd);

            AppController.sEventLog.WriteLine("hit {0} ugc:", ugcs.Count);
            AppController.sEventLog.WriteLine("\t", raw.toString());

            if (sUgcViewerPage == null)
            {
                sUgcViewerPage = new PoiViewerPage(this);
            }

            if (sUgcViewerPage.setContent(raw))
            {
                mIsActive = false;
                sUgcViewerPage.ShowDialog();
                mBlendTimer.Change(0, 3000);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Sends position sample to the server.
        /// lat/lon format broken on server ?
        /// </summary>
        public void sendSample(float lat, float lon)
        {
//            if (DiwiPageBase.sCurrentPage != null)
//                DiwiPageBase.sCurrentPage.printStatus(AppController.sDistanceMoved.ToString());


            if (mAgentKey != null)
            {
                XMLement xml = new XMLement(Protocol.TAG_NAV_POINT_REQ);
                XMLement pt  = new XMLement("pt");

                pt.addAttribute("lon", lon.ToString(GpsReader.mUSFormat));
                pt.addAttribute("lat", lat.ToString(GpsReader.mUSFormat));

                xml.addChild(pt);

                xml = utopiaRequest(xml);

                if (xml != null && xml.tag == Protocol.TAG_NAV_POINT_RSP)
                {
                    if (poiCallback != null)
                    {
                        poiCallback(xml, GpsReader.lat, GpsReader.lon);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// get route list.
        /// </summary>
        public XMLement getRouteList()
        {
            if (mAgentKey != null)
            {
                XMLement req1 = new XMLement(Protocol.TAG_GET_ROUTELIST_REQ);
                XMLement req2 = new XMLement(Protocol.TAG_GET_ROUTELIST_REQ);
                req1.addAttribute("type", "fixed");
                req2.addAttribute("type", "generated");

                req1 = utopiaRequest(req1);
                req2 = utopiaRequest(req2);

                if (req1 != null && req2 != null && (req1.tag == Protocol.TAG_GET_ROUTELIST_RSP) && (req1.tag == Protocol.TAG_GET_ROUTELIST_RSP))
                {
                    for (int i = 0; ; i++)
                    {
                        XMLement x = req1.getChild(i);
                        if (x != null)
                        {
                            req2.addChild(x);
                        }
                        else
                        {
                            break;
                        }
                    }
                    return(req2);
                }
                else
                {
                    return(null);
                }
            }
            return(new XMLement("NotLoggedInError"));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Encapsulate request in utopia request.
        /// </summary>
        public XMLement utopiaRequest(XMLement anElement)
        {
            XMLement req = new XMLement();

            req.tag = Protocol.TAG_UTOPIA_REQ;
            req.addChild(anElement);
            lock (this) {
                req = doRequest(req, 0);
            }
            if ((req != null) && (req.tag == "utopia-rsp"))
            {
                return(req.firstChild());
            }
            else
            {
                // add error handling!
            }

            return(null);
        }