diff --git a/HotPage.xaml b/HotPage.xaml
index b74bff6..9514d3d 100644
--- a/HotPage.xaml
+++ b/HotPage.xaml
@@ -82,7 +82,7 @@
-
+
diff --git a/HotPage.xaml.cs b/HotPage.xaml.cs
index 8a566df..cc8eb55 100644
--- a/HotPage.xaml.cs
+++ b/HotPage.xaml.cs
@@ -19,14 +19,15 @@ namespace sbbs_client_wp7
public partial class HotPage : PhoneApplicationPage
{
- private HotViewModel viewModel = new HotViewModel();
- private bool isHotTopicsLoading = true;
+ private bool isHotTopicsLoading;
public HotPage()
{
InitializeComponent();
- DataContext = viewModel;
+ if (App.ViewModel.Hot == null)
+ App.ViewModel.Hot = new HotViewModel();
+ DataContext = App.ViewModel.Hot;
}
protected override void OnNavigatedTo(NavigationEventArgs e)
@@ -39,7 +40,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
switch (type)
{
case 0:
- if (viewModel.TopicsGroupItems == null)
+ if (App.ViewModel.Hot.TopicsGroupItems == null)
LoadHotTopics();
break;
}
@@ -48,7 +49,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e)
private void SetLoading()
{
- viewModel.IsLoading = isHotTopicsLoading;
+ App.ViewModel.Hot.IsLoading = isHotTopicsLoading;
}
private void LoadHotTopics()
@@ -71,7 +72,7 @@ private void LoadHotTopics()
newGroup.Add(newItem);
}
- viewModel.TopicsGroupItems = newGroup;
+ App.ViewModel.Hot.TopicsGroupItems = newGroup;
}
});
}
@@ -92,5 +93,10 @@ private void LongListSelector_SelectionChanged(object sender, SelectionChangedEv
new Uri("/TopicPage.xaml?board=" + topic.Board + "&id=" + topic.Id + "&title=" + HttpUtility.UrlEncode(topic.Title), UriKind.Relative));
}
}
+
+ private void Refresh_Click(object sender, EventArgs e)
+ {
+ LoadHotTopics();
+ }
}
}
\ No newline at end of file
diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs
index 1d99124..3299e59 100644
--- a/ViewModels/MainViewModel.cs
+++ b/ViewModels/MainViewModel.cs
@@ -104,6 +104,7 @@ public ObservableCollection FavoratesItems
public CurrentBoardViewModel CurrentBoard { get; set; }
// 当前话题
public CurrentTopicViewModel CurrentTopic { get; set; }
+ public HotViewModel Hot { get; set; }
// 是否已经登陆
public bool IsLogin