Ejemplo n.º 1
0
        void SimConnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1 = (Struct1)data.dwData[0];

                //displayText("title: " + s1.title);
                //displayText("Lat:   " + s1.latitude);
                //displayText("Lon:   " + s1.longitude);
                //displayText("Alt:   " + s1.altitude);

                DisplayText("Heading:   " + s1.heading);
                mapCenter = new Location(s1.latitude, s1.longitude);
                myMap.SetView(mapCenter, 16, 0d);

                MapLayer.SetPosition(ImageLayer.FindChild <Image>(), mapCenter);
                RotateTransform rotateTransform = new RotateTransform(s1.heading);
                ImageLayer.FindChild <Image>().RenderTransform = rotateTransform;

                break;

            default:
                DisplayText("Unknown request ID: " + data.dwRequestID);
                break;
            }
        }