次のコードがあります。
Private Sub LocalizationComboBox_SelectionChanged(sender As Object, e As SelectionChangedEventArgs)
Thread.CurrentThread.CurrentUICulture = TryCast(e.AddedItems(0), CultureInfo)
Application.Current.SaveCulture()
Application.Current.Refresh()
End Sub
そして、私はこれを後で実装しています:
Public NotInheritable Class ApplicationExtensions
Public Shared Sub Refresh(app As Application)
DirectCast(HtmlPage.Window.GetProperty("location"), ScriptObject).Invoke("reload")
End Sub
Public NotInheritable Class ApplicationExtensions
Private Sub New()
End Sub
Public Shared Sub Refresh(app As Application)
DirectCast(HtmlPage.Window.GetProperty("location"), ScriptObject).Invoke("reload")
End Sub
Public Shared Sub LoadCulture(app As Application)
Try
If IsolatedStorageSettings.ApplicationSettings.Contains("language") Then
Dim language = TryCast(IsolatedStorageSettings.ApplicationSettings("language"), String)
If language IsNot Nothing Then
Thread.CurrentThread.CurrentUICulture = New CultureInfo(language)
End If
Else
app.SaveCulture()
End If
Catch
MessageBox.Show("Please, open Silverlight settings and enable Application Storage.")
End Try
End Sub
Public Shared Sub SaveCulture(app As Application)
Try
IsolatedStorageSettings.ApplicationSettings("language") = Thread.CurrentThread.CurrentUICulture.Name
Catch
MessageBox.Show("Please, open Silverlight settings and enable Application Storage.")
End Try
End Sub
End Class
ただし、次のエラーが表示されます。
'SaveCulture' は 'System.Windows.Application' のメンバーではありません 'Refresh' は 'System.Windows.Application' のメンバーではありません 'SaveCulture' は 'System.Windows.Application' のメンバーではありません
誰かがこれで私を助けることができますか? ここで、これの C# バージョンがあり、問題はありません。
ありがとうございます。