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(); }
async Task< BindingSensorData> GenerateBindingData(vwSiteDegree info) { Service.SSHMCDataServiceClient client=new SSHMCDataServiceClient(); var snrinfo= await client.GetSensorInfoAsync(info.SITE_ID); var cctvs = await client.GetCCTVInfoAsync(info.SITE_ID); BindingSensorData result = new BindingSensorData { Title = info.CUSTOMER_NAME, X=info.X, Y=info.Y, Subtitle=info.SITE_NAME, cctvs=cctvs, Items= snrinfo }; return result; }