Imports C1.Silverlight.Maps
Imports System.Collections.Generic
Imports System.Linq
Imports System.Net
Imports System.Reflection
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Shapes

Partial Public Class EarthQuakes
    Inherits UserControl

    Public Sub New()
        InitializeComponent()

        AddHandler Me.Loaded, AddressOf EarthQuakes_Loaded
    End Sub

    Private Sub EarthQuakes_Loaded(sender As Object, e As RoutedEventArgs)
        If Me.maps.Layers.Count = 0 Then
            Dim layer = New C1VectorLayer() With {
                .ItemStyle = DirectCast(Me.Resources("style"), Style)
            }
            VectorLayer.Utils.LoadKMLFromResources(layer, "/" + New AssemblyName(Assembly.GetExecutingAssembly().FullName).Name + ";component/Resources/2.5_day_depth.kml", True, Nothing)
            Me.maps.Layers.Add(layer)
        Else
            Dim layer = TryCast(maps.Layers(0), C1VectorLayer)
            VectorLayer.Utils.LoadKMLFromResources(layer, "/" + New AssemblyName(Assembly.GetExecutingAssembly().FullName).Name + ";component/Resources/2.5_day_depth.kml", True, Nothing)
        End If
    End Sub
End Class
