我做了一个条件,如果变量为空。但是由于 null 变量,这段代码仍然会破坏应用程序。
代码:
var page = IsolatedStorageSettings.ApplicationSettings["qsPage"];
var hash = IsolatedStorageSettings.ApplicationSettings["Ayath"];
if (page == null && hash == null)
// or if i use if (page == null || hash == null)
{
MessageBox.Show("No Bookmark has been saved !");
}
else
{
NavigationService.Navigate(new Uri("/myWeb.xaml?Page=" + page + "&id=" + hash, UriKind.Relative));
}