private void LoadHome()
        {
            LoadHomeProgressBar.Visibility = Visibility.Visible;

            if (_url != null)
            {
                (ApplicationBar.Buttons[0] as ApplicationBarIconButton).IsEnabled = false; //refresh button
                (ApplicationBar.Buttons[1] as ApplicationBarIconButton).IsEnabled = false; //user home button
                (ApplicationBar.Buttons[2] as ApplicationBarIconButton).IsEnabled = false; //history button
                (ApplicationBar.Buttons[3] as ApplicationBarIconButton).IsEnabled = false; //setting button
                OfflineTag.Visibility = System.Windows.Visibility.Collapsed;

                if (_offline)
                {
                    MitbbsHomeBase _savedHome;
                    if (App.Settings.OfflineContentManager.TryLoadOfflineContent(_offlineID, _url, out _savedHome))
                    {
                        _mitbbsHome = _savedHome;
                        DataContext = _mitbbsHome;
                        OfflineTag.Visibility = System.Windows.Visibility.Visible;

                        AsyncCallHelper.DelayCall(
                            () => MitbbsHome_Loaded(this, null)
                            );
                    }
                    else
                    {
                        MessageBox.Show("离线内容不存在");
                        LoadHomeProgressBar.Visibility = Visibility.Collapsed;
                        NavigationService.GoBack();
                    }

                    return;
                }

                if (!AppInfo.IsNetworkConnected())
                {
                    MessageBox.Show("没有可用的网络连接", "无法读取未名空间主页", MessageBoxButton.OK);
                    LoadHomeProgressBar.Visibility = Visibility.Collapsed;
                    (ApplicationBar.Buttons[0] as ApplicationBarIconButton).IsEnabled = true; //refresh button
                    return;
                }

                _mitbbsHome.HomeLoaded += MitbbsHome_Loaded;
                _mitbbsHome.LoadFromUrl(App.WebSession.CreateWebClient(), _url);

                PivotControl.Title = "  " + App.License.AppTitle + " (" + App.WebSession.Username + ")";
            }
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            var parameters = NavigationContext.QueryString;

            if (parameters.ContainsKey("OfflineID"))
            {
                _offline = HtmlAgilityPack.HtmlUtilities.TryParseGuid(parameters["OfflineID"], out _offlineID);
            }

            #if !NODO
            if (!_offline && NavigationService.BackStack.Count() > 1)
            {
                while (NavigationService.BackStack.Count() > 1)
                {
                    NavigationService.RemoveBackEntry();
                }
                App.Settings.CurrentSessionHistory.Reset();
            }
            #endif

            if (PageHelper.SessionHistoryHandleNavigateTo(NavigationService))
            {
                return;
            }

            App.Settings.CurrentSessionHistory.SetLastPageName(NavigationService, "未名主页");

            _selectedPivot = -1;
            _scrollOffset = -1;

            if (parameters.ContainsKey("ShowPage") && !State.ContainsKey("SelectedIndex"))
            {
                _selectedPivot = int.Parse(parameters["ShowPage"]);
            }

            if (_offline && !_pageDeleted && PivotControl.Items.Count >= 4)
            {
                PivotControl.Items.RemoveAt(3);

                ApplicationBar.MenuItems.RemoveAt(0);
                ApplicationBar.MenuItems.RemoveAt(0);
                ApplicationBar.MenuItems.RemoveAt(0);
            }

            if (_offline)
            {
                HeaderImage.Visibility = System.Windows.Visibility.Collapsed;
                HomeImage.Visibility = System.Windows.Visibility.Collapsed;
                PivotControl.Foreground = (Brush)App.Current.Resources["PhoneAccentBrush"];

                if (_mitbbsHome == null)
                {
                    _mitbbsHome = new MitbbsHome();
                }
            }
            else
            {
                if (_mitbbsHome != App.MitbbsHome)
                {
                    _mitbbsHome = App.MitbbsHome;
                    DataContext = _mitbbsHome;
                }
                else if (!_mitbbsHome.IsLoaded)
                {
                    _mitbbsHome.HomeLoaded -= MitbbsHome_Loaded;

                    App.MitbbsHome = new MitbbsHome();
                    _mitbbsHome = App.MitbbsHome;
                    DataContext = _mitbbsHome;
                }
            }

            if (!_mitbbsHome.IsLoaded)
            {
                if (State.ContainsKey("SelectedIndex"))
                {
                    _selectedPivot = (int)State["SelectedIndex"];
                }

                if (State.ContainsKey("ScrollOffset"))
                {
                    _scrollOffset = (double)State["ScrollOffset"];
                }
            }
            else
            {
                _mitbbsHome.ForceUpdateHistoryStatus();
            }

            base.OnNavigatedTo(e);

            #if NODO
            if (!_offline && !AppInfo.IsNetworkConnected() && !_redirected)
            {
                _redirected = true;
                MessageBoxResult result = MessageBox.Show("你想直接查看离线内容吗?", "网络连接不存在", MessageBoxButton.OKCancel);

                if (result == MessageBoxResult.OK)
                {
                    OfflineMenu_Click(this, null);
                    return;
                }
            }
            #endif

            if (!_mitbbsHome.IsLoaded)
            {
                LoadHome();
            }
        }