

Imports System.Windows.Media
Imports System.Windows.Media.Animation

Public Class settstile

    Private player6 As New MediaPlayer()

    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)
            setst.Background = New System.Windows.Media.SolidColorBrush(bluecolor)
        End Try

        Dim sb1 As Storyboard = CType(Me.Resources("setsani"), Storyboard)
        sb1.Begin()

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

    Private Sub settingstileuaTimer_Tick(sender As Object, e As EventArgs)
        Try
            Dim mytilecolor As Color = CType(ColorConverter.ConvertFromString(My.Settings.mecolor), Color)
            setst.Background = New System.Windows.Media.SolidColorBrush(mytilecolor)
        Catch
        End Try
    End Sub

    Private Sub UserControl_MouseLeftButtonUp(sender As Object, e As MouseButtonEventArgs)
        PlayAccentSound()
        Dim setss As New settingshub
        setss.Show()
    End Sub

    Private Sub PlayAccentSound()
        Try
            player6.Volume = 1.0
            player6.Open(New Uri("beltonen/wp7_pressed.mp3", UriKind.Relative))
            player6.Play()
        Catch ex As Exception
            MessageBox.Show("Error playing sound: " & ex.Message)
        End Try
    End Sub

End Class
