예제 #1
0
        async void load()
        {
            WebProxy proxy = new WebProxy();
          
            try
            {

                App myapp = (App)Application.Current;
                
                if (myapp.Deployments == null)
                {
                    ProgressBar.Visibility = Windows.UI.Xaml.Visibility.Visible;
                    LocalStorage local = new LocalStorage();
                    var maps = await proxy.GetDeployments();                  
                    myapp.Deployments = maps;

                    if (local.Deployments.Count > 0)
                    {
                        myapp.Deployments.AddRange(local.Deployments);
                    }
                   
                }
                ProgressBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
                DeploymentListView.ItemsSource = myapp.Deployments;
              
             
                foreach (Deployment deploy in myapp.Deployments)
                {
                      

                    Pushpin pushpin = new Pushpin();
                    //pushpin.Text = deploy.name;

                    Location location = new Location();
                    double lat ,lon;
                    double.TryParse(deploy.latitude, out lat);
                    double.TryParse(deploy.longitude,out lon);
                    location.Longitude = lon;
                    location.Latitude = lat;
                    pushpin.Tapped+=pushpin_Tapped;
                    pushpin.Tag = deploy;

                    MapLayer.SetPosition(pushpin, location);

                    ToolTipService.SetToolTip(pushpin, deploy.name);

                    DeploymentMap.Children.Add(pushpin);
                }


            }
            catch (Exception ex)
            {
                MessageDialog msg = new MessageDialog(ex.Message+ ex.StackTrace);
                msg.ShowAsync();
            }

        }
예제 #2
0
        async void load()
        {

            WebProxy proxy = new WebProxy();
            App app = (App)Application.Current;

            activeDeplyment = app.ActiveMap;
            pageTitle.Text = activeDeplyment.name;

            await proxy.GetIncidents(activeDeplyment);
            ProgressBar.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
            var incidents = proxy.Incidents;

            app.Incidents = incidents;

            IncidentListview.ItemsSource = incidents;

            Location loc = new Location()
            {
                Latitude = activeDeplyment.Latitude,
                Longitude = activeDeplyment.Longitude
            };

            IncidentMap.SetView(loc, 8);

            foreach (Incident i in incidents)
            {
                Pushpin pushpin = new Pushpin();
                pushpin.Tag = i;

                Location location = new Location()
                {
                    Latitude = i.incident.Latitude,
                    Longitude = i.incident.Longitude
                };
                pushpin.Tapped += pushpin_Tapped;

                ToolTipService.SetToolTip(pushpin, i.incident.incidenttitle);

                MapLayer.SetPosition(pushpin, location);
                IncidentMap.Children.Add(pushpin);
            }

        }