예제 #1
0
 void doSIP(int i, string s)
 {
     if (sip)
     {
         AppController.ShowSIP(false);
         sip = false;
     }
     else
     {
         AppController.ShowSIP(true);
         sip = true;
     }
 }
예제 #2
0
        void doFoto(int i, string s)
        {
            mIsActive = false;
            AppController.sGpsReader.storeLocation();
            string fileName = AppController.makeFoto();

            if (fileName != null)
            {
                (new MakePhotoPage(this, fileName)).ShowDialog();
            }
            mIsActive = true;
            mBlendTimer.Change(0, 3000);
        }
예제 #3
0
 public void menuSelect()
 {
     if (mCurrentMenuIndex != -1)
     {
         DiwiMenuCallbackHandler cb = (DiwiMenuCallbackHandler)mCallbacks[mCurrentMenuIndex];
         if (cb != null)
         {
             int i = mCurrentMenuIndex;
             mCurrentMenuIndex = -1;
             AppController.SysClick();
             cb(i, (string)mItems[i]);
         }
     }
 }
예제 #4
0
        void doFoto(int i, string s)
        {
            FileInfo fi = new FileInfo(currentFilename);

            fi.Delete();
            mIsActive       = false;
            currentFilename = AppController.makeFoto();
            mIsActive       = true;
            if (currentFilename != null)
            {
                mFoto.bitmap = new Bitmap(currentFilename);
                draw();
            }
        }
예제 #5
0
        void keydown(Object o, KeyEventArgs e)
        {
            switch (e.KeyValue)
            {
            case (int)sKeys.M_DOWN:
                mMenu.decIndex();
                if (mDoDrawMenu == false)
                {
                    mDoDrawMenu = true;
                    blendCount  = 4;
                }
                draw();
                break;

            case (int)sKeys.M_LEFT:
            case (int)sKeys.S_LEFT:
                if (mIsMapPage)
                {
                    AppController.SysClick();
                    MapHandler.mapRadius *= 1.5F;
                }
                break;

            case (int)sKeys.M_RIGHT:
            case (int)sKeys.S_RIGHT:
                if (mIsMapPage)
                {
                    AppController.SysClick();
                    MapHandler.mapRadius *= 0.75F;
                }
                break;

            case (int)sKeys.M_UP:
                if (mDoDrawMenu == false)
                {
                    mDoDrawMenu = true;
                    blendCount  = 4;
                }
                mMenu.incIndex();
                draw();
                break;
            }

            e.Handled = true;  //all key events handled by the form
            if (e.KeyCode == Keys.Enter)
            {
                mMenu.menuSelect();
            }
        }
예제 #6
0
        public void doMouseClick(int x, int y)
        {
            Point p = new Point(x, y);

            if (mRect.Contains(p))
            {
                AppController.SysClick();
                if (mCallback != null)
                {
                    mParentForm.XorRectangle(mRect.X, mRect.Y, mRect.Width, mRect.Height);
                    mCallback();
                    return;
                }
            }
        }
예제 #7
0
 void doPoi(List <string> pois)
 {
     AppController.doVibrate();
     AppController.poiHit();
     AppController.sEventLog.WriteLine("hit {0} pois:", pois.Count);
     if (sPoiSelectPage == null)
     {
         sPoiSelectPage = new PoiSelectPage(this);
     }
     if (sPoiSelectPage.setContent(pois))
     {
         mIsActive = false;
         sPoiSelectPage.ShowDialog();
         mBlendTimer.Change(0, 3000);
     }
 }
예제 #8
0
        public XMLement deActivateRoute()
        {
            XMLement xml = new XMLement(Protocol.TAG_DEACTIVATE_ROUTE_REQ);

            AppController.showStatus("deActivateRoute");
            lock (this) {
                xml = utopiaRequest(xml);
            }
            if (xml != null && xml.tag == Protocol.TAG_DEACTIVATE_ROUTE_RSP)
            {
                return(xml);
            }
            else
            {
                return(null);
            }
        }
예제 #9
0
        public XMLement routeHome()
        {
            XMLement xml = new XMLement(Protocol.TAG_NAV_HOME_REQ);

            AppController.showStatus("route to start");

            lock (this) {
                xml = utopiaRequest(xml);
            }
            if (xml != null && xml.tag == Protocol.TAG_NAV_HOME_RSP)
            {
                return(xml);
            }
            else
            {
                return(null);
            }
        }
예제 #10
0
        public XMLement doNavStart()
        {
            XMLement xml = new XMLement(Protocol.TAG_NAV_START_REQ);

            AppController.showStatus("navStart");
            lock (this) {
                xml = utopiaRequest(xml);
            }
            if (xml != null && xml.tag == Protocol.TAG_NAV_START_RSP)
            {
                mNavStarted = true;
                return(xml);
            }
            else
            {
                return(null);
            }
        }
예제 #11
0
        protected virtual void doTerug(int i, string s)
        {
            mIsActive = false;

            if (mainMenu1 != null)
            {
                AppController.ShowSIP(false);
                mainMenu1.Dispose();
                mainMenu1 = null;
            }

            mBlendTimer.Change(Timeout.Infinite, Timeout.Infinite);
            if (mParent != null)
            {
                //   mParent.Activate();
                mParent.Show();
            }
            Close();
        }
예제 #12
0
        public XMLement getPOI(string id)
        {
            XMLement xml = new XMLement(Protocol.TAG_POI_GET_REQ);

            AppController.showStatus("getPOI");
            xml.addAttribute(Protocol.ATTR_ID, id);
            lock (this) {
                xml = utopiaRequest(xml);
            }
            if (xml != null && xml.tag == Protocol.TAG_POI_GET_RSP)
            {
                xmlString = xml.toString();
                return(xml);
            }
            else
            {
                return(null);
            }
        }
예제 #13
0
        public XMLement addMedium(string id)
        {
            XMLement xml = new XMLement(Protocol.TAG_ADD_MEDIUM_REQ);

            AppController.showStatus("addMedium");
            xml.addAttribute(Protocol.ATTR_ID, id);
            xml.addAttribute("lat", AppController.sGpsReader.storedLattitude);
            xml.addAttribute("lon", AppController.sGpsReader.storedLongtitude);
            lock (this) {
                xml = utopiaRequest(xml);
            }
            if (xml != null && xml.tag == Protocol.TAG_ADD_MEDIUM_RSP)
            {
                return(xml);
            }
            else
            {
                return(null);
            }
        }
예제 #14
0
        public XMLement activateRoute(int routeID, bool init)
        {
            XMLement xml = new XMLement(Protocol.TAG_ACTIVATE_ROUTE_REQ);

            AppController.showStatus("activateRoute");
            xml.addAttribute(Protocol.ATTR_ID, routeID);
            xml.addAttribute(Protocol.ATTR_INIT, init.ToString());

            lock (this) {
                xml = utopiaRequest(xml);
            }
            if (xml != null && xml.tag == Protocol.TAG_ACTIVATE_ROUTE_RSP)
            {
                return(xml);
            }
            else
            {
                return(null);
            }
        }
예제 #15
0
 public void buttonOK()
 {
     AppController.ShowSIP(false);
     draw();
     AppController.sKwxClient.stop();
     AppController.sKwxClient.start(mUserBox.Text, mPassBox.Text);
     if (AppController.sKwxClient.agentKey != null)
     {
         //   FileInfo fi = new FileInfo(@"\\testvideo.mp4");
         //   if( fi.Exists )
         //       new MediaUploader(fi.FullName, "testVideo", @"video/mp4", null);
         doTerug(0, null);
     }
     else
     {
         MessageBox.Show("Check netwerkinstellingen, usernaam en passwoord...", "Login failed");
         mServerMess.text = "";
         draw();
     }
 }
예제 #16
0
        public string getBoundsMap(int id, float radiusKm, bool hor)
        {
            float    urtLat, urtLon, llbLat, llbLon;
            XMLement req = new XMLement(Protocol.TAG_NAV_GET_MAP_REQ);

            AppController.showStatus("getBoundedMap");

            if (hor)
            {
                urtLat = GpsReader.lat + GpsReader.km2degLat(radiusKm);
                llbLat = GpsReader.lat - GpsReader.km2degLat(radiusKm);
                urtLon = GpsReader.lon + GpsReader.km2degLon((float)(radiusKm * 1.5));
                llbLon = GpsReader.lon - GpsReader.km2degLon((float)(radiusKm * 1.5));
                req.addAttribute("height", "240");
                req.addAttribute("width", "320");
            }
            else
            {
                urtLat = GpsReader.lat + GpsReader.km2degLat((float)(radiusKm * 1.5));
                llbLat = GpsReader.lat - GpsReader.km2degLat((float)(radiusKm * 1.5));
                urtLon = GpsReader.lon + GpsReader.km2degLon(radiusKm);
                llbLon = GpsReader.lon - GpsReader.km2degLon(radiusKm);
                req.addAttribute("height", "320");
                req.addAttribute("width", "240");
            }

            MapHandler.setTempBounds(hor, urtLat, urtLon, llbLat, llbLon);

            req.addAttribute("llbLat", llbLat.ToString(mUSFormat));
            req.addAttribute("llbLon", llbLon.ToString(mUSFormat));
            req.addAttribute("urtLat", urtLat.ToString(mUSFormat));
            req.addAttribute("urtLon", urtLon.ToString(mUSFormat));

            req = utopiaRequest(req);

            if ((req != null) && (req.tag == Protocol.TAG_NAV_GET_MAP_RSP))
            {
                return(req.getAttributeValue("url"));
            }
            return(null);
        }
예제 #17
0
        private XMLement doRequest(XMLement anElement, int lAttempt)
        {
            string url = mServer;

            if (mAgentKey != null)
            {
                url += "?agentkey=" + mAgentKey;
            }
            else
            {
                // login
                url += "?timeout=" + Diwi.Properties.Resources.KwxServerTimeout;
            }

            try {
                // create the web request
                sKwxWebRequest = (HttpWebRequest)WebRequest.Create(url);
                UTF8Encoding encoding  = new UTF8Encoding();
                byte[]       postBytes = encoding.GetBytes(anElement.toString());

                sKwxWebRequest.KeepAlive     = true;
                sKwxWebRequest.Timeout       = 25000;
                sKwxWebRequest.Method        = "POST";
                sKwxWebRequest.ContentType   = "text/xml";
                sKwxWebRequest.ContentLength = postBytes.Length;
                Stream postStream = sKwxWebRequest.GetRequestStream();
                postStream.Write(postBytes, 0, postBytes.Length);
                postStream.Close();

                // make the connect
                HttpWebResponse resp = (HttpWebResponse)sKwxWebRequest.GetResponse();

                // get the page data
                StreamReader sr       = new StreamReader(resp.GetResponseStream());
                string       pageData = sr.ReadToEnd();
                sr.Close();

                // get the status code (should be 200)
                // status = resp.StatusCode;

                // close the connection
                resp.Close();

                AppController.showStatus("");

                return(XMLement.createFromRawXml(pageData));
            } catch (TimeoutException e) {
                AppController.sEventLog.WriteLine("Caught Timeout Excepotion;");
                if (lAttempt < 3)
                {
                    AppController.sEventLog.WriteLine("trying again...");
                    return(doRequest(anElement, lAttempt + 1));
                }
                else
                {
                    AppController.sEventLog.WriteLine("aborting after 3 attemps...");
                }
                AppController.showStatus("");
                return(null);
            } catch (WebException e) {
                AppController.showStatus("");
                string str = string.Format("Caught WebException: {0}", e.Status.ToString());
                AppController.sEventLog.WriteLine(str);
                return(new XMLement("web-exception"));
            } catch (Exception) {
                AppController.showStatus("");
                return(null);
            }
        }
예제 #18
0
 void doPlay(int i, string s)
 {
     AppController.playVideo(currentFilename);
     draw();
 }
예제 #19
0
 protected override void doTerug(int i, string s)
 {
     AppController.deactivate();
     Close();
     Application.Exit();
 }