Beispiel #1
0
        //List<ProjectSite> SiteList = new List<ProjectSite>();
        //initialised below
        public Dashboard()
        {
            this.InitializeComponent();

            StartTimers();

            SmallMap.Loaded += Mapsample_Loaded;
            //foreach( appt a in list) create marker on calander
            //foreach(appt a in list) if a.date == today create marker on map
            //sitelist read from db - make list;

            //initialize webview for weather - link from dian
            WebView_Weather.Navigate(new Uri("http://forecast.io/embed/#lat=42.3583&lon=-71.0603&name=the Job Site&color=#00aaff&font=Segoe UI&units=uk"));
        }
        private async void Mapsample_Loaded(object sender, RoutedEventArgs e)
        {
            geoLocator = new Geolocator();
            geoLocator.DesiredAccuracy = PositionAccuracy.High;
            Geoposition pos = await geoLocator.GetGeopositionAsync();

            WebView_Weather.Navigate(new Uri("http://forecast.io/embed/#lat=" + pos.Coordinate.Point.Position.Latitude.ToString() + "&lon=" + pos.Coordinate.Point.Position.Longitude.ToString() + "&name=the Job Site&color=#00aaff&font=Segoe UI&units=ca"));

            var center =
                new Geopoint(new BasicGeoposition()
            {
                Latitude  = pos.Coordinate.Point.Position.Latitude,
                Longitude = pos.Coordinate.Point.Position.Longitude
            });
            await SmallMap.TrySetSceneAsync(MapScene.CreateFromLocationAndRadius(center, 5000));

            //Define MapIcon
            MapIcon myPOI = new MapIcon {
                Location = center, NormalizedAnchorPoint = new Point(0.5, 1.0), Title = "You", ZIndex = 0
            };

            //add to map and center it
            SmallMap.MapElements.Add(myPOI);
        }