Пример #1
0
 /// <summary>
 /// 初始化界面
 /// </summary>
 private void CarInit(object obj)
 {
     try
     {
         if (obj == null)
         {
             return;
         }
         if (!this.m_canvas.IsHandleCreated)
         {
             return;
         }
         this.m_canvas.Invoke((EventHandler)(delegate
         {
             IList <CarInfo> Cars = obj as IList <CarInfo>;
             agvs.Clear();
             AllLands.Clear();
             AllLands = AGVDAccess.AGVClientDAccess.LoadLandByCondition("1=1");
             List <IDrawObject> agvobjs = m_data.ActiveLayer.Objects.Where(p => p.Id == "AGVTool").ToList();
             m_data.DeleteObjects(agvobjs);
             foreach (CarInfo carinfo in Cars)
             {
                 AGVTool agv = new AGVTool();
                 agv.HandState = carinfo.JCState;
                 agv.Agv_id = carinfo.AgvID.ToString();
                 //LandmarkInfo CurLand = AllLands.Where(p => p.LandmarkCode == carinfo.CurrSite.ToString()).FirstOrDefault();
                 //if (CurLand != null)
                 //{ agv.Position = new UnitPoint(CurLand.LandX, CurLand.LandY); }
                 //else
                 //{ agv.Position = new UnitPoint(carinfo.X, carinfo.Y); }
                 agv.Position = new UnitPoint(carinfo.X, carinfo.Y);
                 if (carinfo.bIsCommBreak)
                 {
                     agv.IsViewable = false;
                 }
                 else
                 {
                     agv.IsViewable = true;
                 }
                 m_data.AddObject(m_data.ActiveLayer, agv);
                 m_canvas.DoInvalidate(true);
                 agvs.Add(carinfo);
             }
             bsCar.DataSource = agvs;
             bsCar.ResetBindings(false);
         }));
     }
     catch (Exception ex)
     { }
 }