Skip to content

Commit

Permalink
版面清除未读
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Mar 6, 2012
1 parent 65e441f commit 5eed9b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions BoardPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<shell:ApplicationBarIconButton Click="NewPost_Click" IconUri="/Images/new.png" Text="发帖"/>
<shell:ApplicationBarIconButton Click="Refresh_Click" IconUri="/Images/refresh.png" Text="刷新"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Click="Clear_Click" Text="全部标记为已读"/>
<shell:ApplicationBarMenuItem Click="Settings_Click" Text="版面设置"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
Expand Down
9 changes: 9 additions & 0 deletions BoardPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ private void Settings_Click(object sender, EventArgs e)
NavigationService.Navigate(new Uri("/BoardSettingsPage.xaml", UriKind.Relative));
}

private void Clear_Click(object sender, EventArgs e)
{
App.Service.BoardMarkRead(App.ViewModel.CurrentBoard.EnglishName);
foreach (TopicViewModel topic in App.ViewModel.CurrentBoard.Topics)
{
topic.Unread = false;
}
}

private void LoadMore_Click(object sender, RoutedEventArgs e)
{
App.ViewModel.CurrentBoard.IsLoaded = false;
Expand Down
8 changes: 8 additions & 0 deletions Sbbs/Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ public void Board(string board, int mode, int start, int limit, Action<TopicColl
wc.DownloadStringAsync(uri, new ServiceArg<TopicCollection>() { Callback = callback });
}

// 版面标记已读
public void BoardMarkRead(string board)
{
WebClient wc = new WebClient();
Uri uri = new Uri(apiBase + "board/" + board + "/markread" + apiPost + "?token=" + HttpUtility.UrlEncode(Token));
wc.DownloadStringAsync(uri);
}

// 获取话题
public void Topic(string board, int id, int start, int limit, Action<TopicCollection, bool, string> callback)
{
Expand Down

0 comments on commit 5eed9b1

Please sign in to comment.