using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using C1.Silverlight.Maps;
using Olympics.WSData;
using System.Windows.Data;

namespace Olympics
{
    public partial class MedalsMap : UserControl
    {
        public MedalsMap()
        {
            InitializeComponent();
            InitializeMapLayers();

            // load data
            DataBase.DataUpdated += (s, a) => { LoadData(); };
        }

        C1MapItemsLayer _countries;

        private void InitializeMapLayers()
        {
            _countries = new C1MapItemsLayer { ItemTemplate = CountryTemplate };
            myMap.Layers.Add(_countries);
        }

        private void LoadData()
        {
            _countries.ItemsSource = DataBase.Data;
        }
    }
}
