Imports System.Numerics

Public Class calendartile
    Private player9 As New MediaPlayer()
    Private Sub UserControl_Loaded(sender As Object, e As RoutedEventArgs)
        dayofmonth.Content = System.DateTime.Now.Day


        Try
            My.Settings.Reload()
        Catch

            My.Settings.mecolor = "#19A2DE"

            Dim bluecolor As Color = CType(ColorConverter.ConvertFromString(My.Settings.mecolor), Color)
            cal.Background = New System.Windows.Media.SolidColorBrush(bluecolor)
        End Try


        Dim colortile2534Timer = New System.Windows.Threading.DispatcherTimer()
        AddHandler colortile2534Timer.Tick, AddressOf colortile2534Timer_Tick
        colortile2534Timer.Interval = New TimeSpan(0, 0, 1)
        colortile2534Timer.Start()
    End Sub

    Private Sub colortile2534Timer_Tick(sender As Object, e As EventArgs)
        dayofmonth.Content = System.DateTime.Now.Day
        Try
            Dim mytilecolor As Color = CType(ColorConverter.ConvertFromString(My.Settings.mecolor), Color)
            cal.Background = New System.Windows.Media.SolidColorBrush(mytilecolor)
        Catch
        End Try
    End Sub

    Private Sub UserControl_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs)
        PlayAccentSound()
        Dim calds As New Calendar
        calds.Show()
    End Sub
    Private Sub PlayAccentSound()
        Try
            player9.Volume = 1.0
            player9.Open(New Uri("beltonen/wp7_pressed.mp3", UriKind.Relative))
            player9.Play()
        Catch ex As Exception
            MessageBox.Show("Error playing sound: " & ex.Message)
        End Try
    End Sub

End Class
