我有以下代码:
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# 版本,没有问题。
谢谢大家。