【发布时间】:2013-11-30 19:48:03
【问题描述】:
我正在制作应用程序,它涉及使用文本文件等创建本地帐户。第一次运行时,应用程序旨在导航到名为“MainPage”的页面,但如果文件“FTR.dat”没有t 存在于此特定文件夹中,然后它将导航到“CreateAccount”页面,但如果文件“FTR.dat”确实存在于该特定文件夹中,那么它将导航到“MainPage”
但我得到了这个 nullrefrenceexception 错误: 这是我的代码:
Dim myIsolatedStorage As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
If myIsolatedStorage.FileExists("PasswordManagerAccount/FTR.dat") = False Then
NavigationService.Navigate(New Uri("/CreateAccount.xaml", UriKind.Relative))
ElseIf myIsolatedStorage.FileExists("PasswordManagerAccount/FTR.dat") = True Then
NavigationService.Navigate(New Uri("/MainPage.xaml", UriKind.Relative))
End If
谢谢!
【问题讨论】:
-
让我猜猜:你是从页面的构造函数调用这段代码
-
嗨,很抱歉回复晚了!但是,是的,如果这就是您的意思,我是从 MainPage 调用它的。那么我该如何执行呢?
标签: windows-phone-7 navigation nullreferenceexception