public MainWindow()
 {
     InitializeComponent();
     KathMap.Focus();
     KathMap.Mode = new AerialMode(true);
     KathMap.ViewChangeOnFrame += new EventHandler <MapEventArgs>(MyMap_ViewChangeOnFrame);
 }
Ejemplo n.º 2
0
        private void KathMap_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;
            Point    mousePosition = e.GetPosition(this);
            Location pinLocation   = KathMap.ViewportPointToLocation(mousePosition);

            Pushpin pin = new Pushpin();

            pin.Location          = pinLocation;
            pin.MouseDoubleClick += new MouseButtonEventHandler(KathMap_MouseDoubleClick);


            KathMap.Children.Add(pin);
        }
        private void KathMap_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var client = new RestClient("https://api.openweathermap.org/data/2.5/weather?q=Dinalupihan&AppID=1b140e3fe06f80d15e36286b073f86ab");

            var request = new RestRequest("", Method.GET);

            IRestResponse response = client.Execute(request);

            var content = response.Content;

            var area = JsonConvert.DeserializeObject <WeatherArea>(content);

            lblDateTime.Content = DateTime.Now.ToString("dd MMMM yyyy hh:mm tt");

            lblSummary.Content = " Description: " + area.Weather[0].description;

            lblTemperature.Content = " Temperature: " + area.Main.Temp;

            lblHumidity.Content = " Humidity: " + area.Main.Humidity;

            lblPressure.Content = " Pressure: " + area.Main.Pressure;

            lblWindspeed.Content = " Windspeed: " + area.Wind.speed;

            e.Handled = true;
            Point    mousePosition = e.GetPosition(this);
            Location pinLocation   = KathMap.ViewportPointToLocation(mousePosition);

            Pushpin pin = new Pushpin();

            pin.Location          = pinLocation;
            pin.MouseDoubleClick += new MouseButtonEventHandler(KathMap_MouseDoubleClick);


            KathMap.Children.Add(pin);
        }