Exemple #1
0
        public void UpdateCarLocation(GPSTrackingMonitor.Communications.MessagePool trackingMessagePool)
        {
            MapObjects2.Point    oCarLocation = new MapObjects2.PointClass();
            MapObjects2.GeoEvent oGeoevent    = null;

            GPSTrackingMonitor.Communications.MessagePool.ValueCollection oTrackingMessages = trackingMessagePool.Values;

            foreach (CommnicationMessage.GPSTrackingMessage oTrackingMessage in oTrackingMessages)
            {
                oCarLocation.X = oTrackingMessage.X;
                oCarLocation.Y = oTrackingMessage.Y;

                oGeoevent = this._trackingLayer.FindEvent(oTrackingMessage.CarNumber);

                if (oGeoevent == null)
                {
                    //  this.AddCustomSymbol(oTrackingMessage.CarNumber);
                    oGeoevent     = this._trackingLayer.AddEvent(oCarLocation, this._carSymbolIndex);
                    oGeoevent.Tag = oTrackingMessage.CarNumber;
                }
                else
                {
                    if (oGeoevent.X == oTrackingMessage.X && oGeoevent.Y == oTrackingMessage.Y)
                    {
                        continue;
                    }

                    oGeoevent.MoveTo(oTrackingMessage.X, oTrackingMessage.Y);
                }
            }

            this._trackingLayer.Refresh(true, this._mapControl.Extent);
        }
        private void CarInfosReceiver_ProcessMessageEvent(object sender, GPSTrackingMonitor.Communications.MessageArguments e)
        {
            try
            {
                this.Invoke((MethodInvoker) delegate
                {
                    GPSTrackingMonitor.Communications.MessagePool.ValueCollection oTrackingMessages = e.MessageCollection.Values;

                    foreach (CommnicationMessage.GPSTrackingMessage oTrackingMessage in oTrackingMessages)
                    {
                        DataRow dr = GlobeVariables.RealtimeCarInfosTable.NewRow();

                        RealtimeMonite.DataStructConverter.CommInfosToDataRow(oTrackingMessage, ref dr);
                        RealtimeMonite.TrackingDataTableStruct.UpdateRow(dr, ref GlobeVariables.RealtimeCarInfosTable);
                    }
                });
            }
            catch { }
        }