Esempio n. 1
0
        protected   async override void OnNavigatedTo(NavigationEventArgs e)
        {
            BindingSensorData data;
            base.OnNavigatedTo(e);
            current_vwSiteDegree = e.Parameter as vwSiteDegree;
            this.DefaultViewModel["Group"] = data = await GenerateBindingData(current_vwSiteDegree);
            this.MapControls.ItemsSource = data.Items;
            this.cctvControls.ItemsSource = data.cctvs;
            foreach (tblCCTV cctv in data.cctvs)
            {
                Controls.CCTV cctvctl = new Controls.CCTV() { DataContext = cctv };

                cctvctl.Margin = new Thickness(0);
                cctvctl.Width = 300;
                cctvctl.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch;
                cctvctl.Tapped += cctvctl_Tapped;
                
                this.stkCCTV.Children.Add(cctvctl);
            }
           // tmp.DataContext = data.Items.FirstOrDefault(n => n.CURRENT_DEGREE == 3);
            this.map.SetView(new Bing.Maps.Location() { Longitude = data.X, Latitude = data.Y }, 19);
            tmr.Interval = TimeSpan.FromSeconds(60);
            tmr.Tick += tmr_Tick;
            tmr.Start();
        
        }
Esempio n. 2
0
        void cctvctl_Tapped(object sender, TappedRoutedEventArgs e)
        {
            Controls.CCTV tapedCCTV = sender as Controls.CCTV;
            if (largeCCTV!= null)
            {
                this.LayoutRoot.Children.Remove(largeCCTV);

            }
              largeCCTV=new Controls.CCTV(){Margin=new Thickness(10), DataContext=tapedCCTV.DataContext,HorizontalAlignment= Windows.UI.Xaml.HorizontalAlignment.Stretch,VerticalAlignment= Windows.UI.Xaml.VerticalAlignment.Stretch};
              Grid.SetRow(largeCCTV,2);
              Grid.SetColumn(largeCCTV,1);
              this.LayoutRoot.Children.Add(largeCCTV);
              Grid.SetRowSpan(this.grdMap, 1);
              this.map.SetView(new Bing.Maps.Location()
              {
                  Longitude = (double)(tapedCCTV.DataContext as tblCCTV).X,
                  Latitude = (double)(tapedCCTV.DataContext as tblCCTV).Y
              });

              largeCCTV.DoubleTapped += largeCCTV_DoubleTapped;
             
            //throw new NotImplementedException();
        }