Public Class painttile

    Private player30 As New MediaPlayer()

    Private Sub cmtileua_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs) Handles painttileua.MouseLeftButtonUp
        PlayAccentSound()
        Process.Start("mspaint.exe")
    End Sub

    Private Sub UserControl_Loaded(sender As Object, e As RoutedEventArgs)
        Try
            My.Settings.Reload()
        Catch

            My.Settings.mecolor = "#19A2DE"

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

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

    Private Sub painttileuaTimer_Tick(sender As Object, e As EventArgs)
        Try
            Dim mytilecolor As Color = CType(ColorConverter.ConvertFromString(My.Settings.mecolor), Color)
            painttt.Background = New System.Windows.Media.SolidColorBrush(mytilecolor)
        Catch
        End Try
    End Sub
    Private Sub PlayAccentSound()
        Try
            player30.Volume = 1.0
            player30.Open(New Uri("beltonen/wp7_pressed.mp3", UriKind.Relative))
            player30.Play()
        Catch ex As Exception
            MessageBox.Show("Error playing sound: " & ex.Message)
        End Try
    End Sub

End Class
