Ejemplo n.º 1
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
               db =  slSecure.DB.GetDB();
            var q = from n in db.GetTblERPlaneQuery() select n;


            cbDiagramSelect.ItemsSource = await slSecure.DB.LoadAsync<tblERPlane>(db, q);

            
         //   AI ai = new AI();
         //   tblItem info = CreateInputItemInfo("AI", "AI", "Unit", 99.9, 0);

         //   ai.DataContext = info;
         //   ai.SetBinding(AI.DegreeeProperty, new Binding("Degreee"));
            
         //   this.lstTool.Items.Add(ai);
         //   DI di = new DI();
         //   info = CreateInputItemInfo("DI", "DI", "單位", 100, 0);
         //   di.SetBinding(DI.DegreeeProperty, new Binding("Degreee"));
         //   di.DataContext = info;
         //   this.lstTool.Items.Add(di);

         //   CCTV cctv = new CCTV();
         //   lstTool.Items.Add(cctv);

         //   DOOR door = new DOOR();
         //   lstTool.Items.Add(door);

            

         //  // foreach (UIElement ee in LayoutRoot.Children )
         //  // {
         //  //     ((I_IO)(ee)).IsSelect = true;
         //  // }

         //  //InputItemInfo  info= CreateInputItemInfo("AI", "Voltage", "volts", 100,0);
         
         //  //this.AI.DataContext = info;
         //  //this.AI.SetBinding(AI.DegreeeProperty, new Binding("Degreee"));
         
         ////  info.Degreee = 1;

         //   db = new slSecure.Web.SecureDBContext();
         //   EntityQuery<slSecure.Web.tblSite> q = db.GetTblSiteQuery();
         //   var lo = db.Load(q);
            
         //   lo.Completed += (s, a) =>
         //       {
         //           cbDiagramSelect.ItemsSource = lo.Entities;
         //       };

        }
Ejemplo n.º 2
0
        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();
        }