/// <summary>
 /// 建立新 tblERPlane 物件。
 /// </summary>
 /// <param name="planeID">PlaneID 屬性的初始值。</param>
 /// <param name="eRID">ERID 屬性的初始值。</param>
 /// <param name="planeName">PlaneName 屬性的初始值。</param>
 public static tblERPlane CreatetblERPlane(global::System.Int32 planeID, global::System.Int32 eRID, global::System.String planeName)
 {
     tblERPlane tblERPlane = new tblERPlane();
     tblERPlane.PlaneID = planeID;
     tblERPlane.ERID = eRID;
     tblERPlane.PlaneName = planeName;
     return tblERPlane;
 }
        protected async  override void OnNavigatedTo(NavigationEventArgs e)
        {
            client = new MyClient("CustomBinding_ISecureService", false);
         
            db = new SecureDBContext();
            this.PlaneID = int.Parse(this.NavigationContext.QueryString["PlaneID"]);

           


            this.image.Source = new BitmapImage(new Uri("/Diagrams/" + PlaneID + ".png", UriKind.Relative));
#if !R23
          
#endif
            if (!IsExit)
            await GetALLDoorBindingData(PlaneID);
            if (!IsExit)
            await GetALLCCTVBindingData(PlaneID);
            if (!IsExit)
            await GetAllItemBindingData(PlaneID);
            if (!IsExit)
            await GetAllItemGroupBindingData(PlaneID);
#if !R23

#endif
            PlaceDoor();
            PlaceCCTV();
            PlaceItem();
            PlaceItemGroup();
            var erplanes= await  db.LoadAsync<tblERPlane>(db.GetTblERPlaneQuery().Where(n=>n.PlaneID==this.PlaneID));
           this.tblPlane= erplanes.FirstOrDefault();
           this.DataContext = tblPlane;
           // tblPlane.PlaneName


      

           client.OnRegistEvent += async (s) =>
           {

               if (!IsExit)
                   await HookDoorEvent(PlaneID);
               if (!IsExit)
                   await HookItemValueChangeEvent(PlaneID);

           };
           client.OnDoorEvent += client_OnDoorEvent;
           client.OnItemValueChangedEvent += client_OnItemValueChangedEvent;
           if (!IsExit)
               await client.RegistAndGetKey();
        }
 /// <summary>
 /// 將新物件加入 tblERPlane EntitySet 的方法已被取代。請考慮改為使用關聯的 ObjectSet&lt;T&gt; 屬性的 .Add 方法。
 /// </summary>
 public void AddTotblERPlane(tblERPlane tblERPlane)
 {
     base.AddObject("tblERPlane", tblERPlane);
 }