예제 #1
0
        public MainWindow()
        {
            MainWind = this;
            InitializeComponent();

            GPS.PositionReceived         += new NMEAParse.PositionReceivedEventHandler(GPS_PositionReceived);
            GPS.SatellitesInViewReceived += new NMEAParse.SatellitesInViewReceivedEventHandler(GPS_SatellitesInViewReceived);
            GPS.SatellitesUsed           += new NMEAParse.SatellitesUsedReceivedEventHandler(GPS_SatellitesUsed);
            GPS.SpeedReceived            += new NMEAParse.SpeedReceivedEventHandler(GPS_SpeedReceived);
            GPS.BearingReceived          += new NMEAParse.BearingReceivedEventHandler(GPS_BearingReceived);
            GPS.FixLost                 += new NMEAParse.FixLostEventHandler(GPS_FixLost);
            GPS.FixObtained             += new NMEAParse.FixObtainedEventHandler(GPS_FixObtained);
            GPS.HDOPReceived            += new NMEAParse.HDOPReceivedEventHandler(GPS_HDOPReceived);
            GPS.EllipsoidHeightReceived += new NMEAParse.EllipsoidHeightReceivedEventHandler(GPS_EllipsoidHeightReceived);

            SerializablePolyLine pl = new SerializablePolyLine();

            pl = (SerializablePolyLine)xmlIO.loadSettings(typeof(SerializablePolyLine), "lasttrack.xml");

            if (pl != null)
            {
                GPSTrack = pl.GetPolyLine();
            }
            else
            {
                GPSTrack.Stroke          = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
                GPSTrack.StrokeThickness = 2;
                GPSTrack.Opacity         = 0.7;
                GPSTrack.Locations       = new LocationCollection();
            }
            Map.Children.Add(GPSTrack);

            HeadingLine.Stroke          = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Red);
            HeadingLine.StrokeThickness = 3;
            HeadingLine.Opacity         = 0.5;
            HeadingLine.Locations       = new LocationCollection();
            HeadingLine.Locations.Add(new Location(0, 0));
            HeadingLine.Locations.Add(new Location(0, 0));
            Map.Children.Add(HeadingLine);


            tcpCli = new TCPCli("192.168.0.1", 60660, MainWind.bConnectGPS, MainWind.tGPSConnStatus);
            tcpCli.StartClient();

            statusCli = new TCPCli("192.168.0.10", 9940, MainWind.bConnectStatus, MainWind.tStatusConnStatus);
            statusCli.StartClient();
            statusCli.debug = true;

            GPSParser = new Thread(new ThreadStart(HandleGPSstring));
            GPSParser.Start();

            loadPolyFromFile();
        }
예제 #2
0
        private static System.Timers.Timer _PhotoReqTimerLeft, _PhotoReqTimerCenter, _PhotoReqTimerRight; // From System.Timers

        public MainWindow()
        {
            InitializeComponent();
            mainWind = this;

            index[0] = 0;       // Right
            index[1] = 0;       // Center
            index[2] = 0;       // Left

            disp[0] = 0;        // Right
            disp[1] = 0;        // Center
            disp[2] = 0;        // Left

            interval[0] = 2000; // Right
            interval[1] = 2000; // Center
            interval[2] = 2000; // Left

            tcpCli[0] = new TCPCli("192.168.0.50", 1234, bConnectRight, tConnStatusRight);
            tcpCli[1] = new TCPCli("192.168.0.51", 1234, bConnectCenter, tConnStatusCenter);
            tcpCli[2] = new TCPCli("192.168.0.52", 1234, bConnectLeft, tConnStatusLeft);

            Globals.live[0] = true;
            Globals.live[1] = true;
            Globals.live[2] = true;

            /*Globals.photoCollect[0] = new PhotoCollection();
             * Globals.photoCollect[1] = new PhotoCollection();
             * Globals.photoCollect[2] = new PhotoCollection();
             */
            //this.imgRight.SizeMode = PictureBoxSizeMode.Zoom;

            _PhotoReqTimerRight           = new System.Timers.Timer(interval[0]);
            _PhotoReqTimerRight.Elapsed  += new ElapsedEventHandler(_PhotoReqTimerRight_Elapsed);
            _PhotoReqTimerRight.AutoReset = true;
            _PhotoReqTimerRight.Enabled   = true;

            _PhotoReqTimerCenter           = new System.Timers.Timer(interval[1]);
            _PhotoReqTimerCenter.Elapsed  += new ElapsedEventHandler(_PhotoReqTimerCenter_Elapsed);
            _PhotoReqTimerCenter.AutoReset = true;
            _PhotoReqTimerCenter.Enabled   = true;

            _PhotoReqTimerLeft           = new System.Timers.Timer(interval[2]);
            _PhotoReqTimerLeft.Elapsed  += new ElapsedEventHandler(_PhotoReqTimerLeft_Elapsed);
            _PhotoReqTimerLeft.AutoReset = true;
            _PhotoReqTimerLeft.Enabled   = true;

            AddHandler(Keyboard.KeyDownEvent, (KeyEventHandler)HandleKeyDownEvent);
        }