示例#1
0
 public void RefreshList(List <AlarmPosition> list)
 {
     posList = list;
     listView1.Items.Clear();
     selPos = null;
     foreach (AlarmPosition apos in posList)
     {
         if (apos.Car == FormMain.alarmHandleCar)
         {
             continue;
         }
         bool hasIn = false;
         foreach (ListViewItem it in listView1.Items)
         {
             AlarmPosition prePos = it.Tag as AlarmPosition;
             if (prePos.Car == apos.Car)
             {
                 try
                 {
                     if (Pub.DateDiff(DateTime.Parse(prePos.GpsTime), DateTime.Parse(apos.GpsTime)) > 0)
                     {
                         it.SubItems[1].Text = apos.Car.CarNO;
                         it.SubItems[2].Text = apos.Car.Team.TeamName;
                         it.SubItems[3].Text = apos.GpsTime;
                         it.SubItems[4].Text = apos.Status;
                         it.SubItems[5].Text = apos.Alarm;
                         //it.SubItems[6].Text = Position.ALARM_HANDLE[apos.AlarmHandle];
                     }
                 }
                 catch { }
                 hasIn = true;
                 break;
             }
         }
         if (hasIn)
         {
             continue;
         }
         ListViewItem item = new ListViewItem(apos.Id.ToString());
         listView1.Items.Add(item);
         item.SubItems.Add(apos.Car.CarNO);
         item.SubItems.Add(apos.Car.Team.TeamName);
         item.SubItems.Add(apos.GpsTime);
         item.SubItems.Add(apos.Status);
         item.SubItems.Add(apos.Alarm);
         //item.SubItems.Add(Position.ALARM_HANDLE[apos.AlarmHandle]);
         item.Tag = apos;
     }
     labelCount.Text = listView1.Items.Count.ToString();
     if (posList.Count == 0)
     {
         this.Hide();
     }
     else
     {
         button1.Enabled = true;
     }
 }
示例#2
0
        private void listView1_MouseClick(object sender, MouseEventArgs e)
        {
            ListViewItem item = listView1.GetItemAt(e.X, e.Y);

            if (item != null || selPos != (item.Tag as AlarmPosition))
            {
                selPos = item.Tag as AlarmPosition;
            }
        }
示例#3
0
 //刷新报警点
 private void RefreshAlarm(AlarmPosition pos)
 {
     ClearAlarmLayer();
     try
     {
         Feature ftr1 = new Feature(tableAlarm.TableInfo.Columns);
         ftr1.Geometry = new MapInfo.Geometry.Point(mapControl.Map.GetDisplayCoordSys(), new DPoint(pos.Lo, pos.La)) as FeatureGeometry;
         ftr1.Style    = new MapInfo.Styles.BitmapPointStyle("red_" + pos.Direction.ToString() + ".bmp", BitmapStyles.NativeSize, Color.Red, 16);
         ftr1["Label"] = pos.Car.CarNO + " [" + pos.GpsTime + "][" + pos.Alarm + "]";
         tableAlarm.InsertFeature(ftr1);
         tableAlarm.Refresh();
         MoveMap(new DPoint(pos.Lo, pos.La));
     }
     catch { }
 }
示例#4
0
 void frm_onAlarm(AlarmPosition apos)
 {
     if (apos.Car.CarID == car.CarID)
     {
         ListViewItem item = new ListViewItem(apos.Id.ToString());
         listView1.Items.Add(item);
         item.SubItems.Add(apos.Car.CarNO);
         item.SubItems.Add(apos.GpsTime);
         item.SubItems.Add(Position.POINTED[apos.Pointed]);
         item.SubItems.Add(apos.Lo.ToString());
         item.SubItems.Add(apos.La.ToString());
         item.SubItems.Add(Position.DIR[apos.Direction]);
         item.SubItems.Add(apos.Speed.ToString());
         item.SubItems.Add(apos.Status);
         item.SubItems.Add(apos.Alarm);
         item.Tag = apos;
     }
 }
示例#5
0
文件: Car.cs 项目: yfyf510/GPS
        public static new AlarmPosition Parse(String s)
        {
            AlarmPosition pos = new AlarmPosition();

            String[] ss = s.Split(Constant.SPLIT2);
            try
            {
                pos.id          = Int32.Parse(ss[0]);
                pos.carID       = Int32.Parse(ss[1]);
                pos.GpsTime     = ss[2];
                pos.Pointed     = Int32.Parse(ss[3]);
                pos.Lo          = Double.Parse(ss[4]);
                pos.La          = Double.Parse(ss[5]);
                pos.Speed       = Int32.Parse(ss[6]);
                pos.Direction   = Int32.Parse(ss[7]);
                pos.Status      = ss[8];
                pos.Alarm       = ss[9];
                pos.AlarmHandle = Int32.Parse(ss[10]);
            }
            catch { return(null); }
            return(pos);
        }
示例#6
0
 void frm_OnShowPos(AlarmPosition apos)
 {
     OnShowPos(apos);
 }