diff --git a/App.xaml b/App.xaml
index 5c1f537..a551a8c 100644
--- a/App.xaml
+++ b/App.xaml
@@ -80,7 +80,7 @@
-
+
diff --git a/App.xaml.cs b/App.xaml.cs
index 5925094..cfc4fd9 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -108,6 +108,11 @@ private void Application_Activated(object sender, ActivatedEventArgs e)
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
{
// Ensure that required application state is persisted here.
+ if (ViewModel.FavoratesDirectory.First != null)
+ LocalCache.Set>("Favorates", ViewModel.FavoratesDirectory.First.Value);
+ else
+ LocalCache.Set>("Favorates", ViewModel.FavoratesItems);
+ LocalCache.Set>("Topten", ViewModel.ToptenItems);
}
// Code to execute when the application is closing (eg, user hit Back)
diff --git a/BoardPage.xaml b/BoardPage.xaml
index 3a3c601..6f4ae86 100644
--- a/BoardPage.xaml
+++ b/BoardPage.xaml
@@ -53,8 +53,8 @@
-
-
+
+
@@ -75,13 +75,12 @@
-
+
-
+
+
+
diff --git a/BoardPage.xaml.cs b/BoardPage.xaml.cs
index 3d6a8e3..75ee6e6 100644
--- a/BoardPage.xaml.cs
+++ b/BoardPage.xaml.cs
@@ -68,6 +68,11 @@ private void NewPost_Click(object sender, EventArgs e)
NavigationService.Navigate(new Uri("/PostPage.xaml?board=" + App.ViewModel.CurrentBoard.EnglishName, UriKind.Relative));
}
+ private void Settings_Click(object sender, EventArgs e)
+ {
+ NavigationService.Navigate(new Uri("/BoardSettingsPage.xaml", UriKind.Relative));
+ }
+
private void LoadMore_Click(object sender, RoutedEventArgs e)
{
App.ViewModel.CurrentBoard.IsLoaded = false;
diff --git a/BoardSettingsPage.xaml b/BoardSettingsPage.xaml
new file mode 100644
index 0000000..b0e8049
--- /dev/null
+++ b/BoardSettingsPage.xaml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 普通模式
+ 主题模式
+ 论坛模式
+
+
+
+
+
+
diff --git a/BoardSettingsPage.xaml.cs b/BoardSettingsPage.xaml.cs
new file mode 100644
index 0000000..b863017
--- /dev/null
+++ b/BoardSettingsPage.xaml.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Navigation;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+using Microsoft.Phone.Controls;
+
+namespace sbbs_client_wp7
+{
+ public partial class BoardSettingsPage : PhoneApplicationPage
+ {
+ public BoardSettingsPage()
+ {
+ InitializeComponent();
+ }
+
+ protected override void OnNavigatedTo(NavigationEventArgs e)
+ {
+ base.OnNavigatedTo(e);
+
+ // 恢复选择
+ int[] modeMap = { 0, 1, 2, 2 };
+ Mode.SelectedIndex = modeMap[App.Service.BoardMode];
+ }
+
+ private void Mode_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ ListPicker list = sender as ListPicker;
+
+ // 设置并保存模式
+ int[] modeMap = { 0, 1, 3};
+ int mode = modeMap[list.SelectedIndex];
+
+ if (mode != App.Service.BoardMode)
+ {
+ App.Service.BoardMode = mode;
+ LocalCache.Set("BoardMode", App.Service.BoardMode);
+
+ // 刷新版面以生效
+ App.ViewModel.CurrentBoard.NeedRefresh = true;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Images/cancel.png b/Images/cancel.png
new file mode 100644
index 0000000..4dd724f
Binary files /dev/null and b/Images/cancel.png differ
diff --git a/Images/save.png b/Images/save.png
new file mode 100644
index 0000000..d49940e
Binary files /dev/null and b/Images/save.png differ
diff --git a/Sbbs/Service.cs b/Sbbs/Service.cs
index 925a4a5..259fa89 100644
--- a/Sbbs/Service.cs
+++ b/Sbbs/Service.cs
@@ -28,6 +28,9 @@ public class Service
// 用户认证Token
public string Token { get; set; }
+ // 默认版面模式
+ public int BoardMode { get; set; }
+
// 登录换取Token
public void Login(string username, string password, Action callback)
{
@@ -60,9 +63,14 @@ public void Favorates(Action callback)
// 获取版面
public void Board(string board, int start, int limit, Action callback)
+ {
+ Board(board, BoardMode, start, limit, callback);
+ }
+
+ public void Board(string board, int mode, int start, int limit, Action callback)
{
WebClient wc = new WebClient();
- Uri uri = new Uri(apiBase + "board/" + board + apiPost + "?token=" + HttpUtility.UrlEncode(Token) + "&start=" + start + "&limit=" + limit);
+ Uri uri = new Uri(apiBase + "board/" + board + apiPost + "?token=" + HttpUtility.UrlEncode(Token) + "&start=" + start + "&limit=" + limit + "&mode=" + mode);
wc.DownloadStringCompleted += DownloadedAndParse;
wc.DownloadStringAsync(uri, new ServiceArg() { Callback = callback });
diff --git a/TopicPage.xaml b/TopicPage.xaml
index 3866b27..7b364dd 100644
--- a/TopicPage.xaml
+++ b/TopicPage.xaml
@@ -52,8 +52,10 @@
-
-
+
+
+
+
diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs
index 9f5cf1a..e402fae 100644
--- a/ViewModels/MainViewModel.cs
+++ b/ViewModels/MainViewModel.cs
@@ -23,6 +23,7 @@ public MainViewModel()
{
// 载入保存的设置
App.Service.Token = LocalCache.Get("Token");
+ App.Service.BoardMode = LocalCache.Get("BoardMode", 3);
// 初始化
CurrentBoard = new CurrentBoardViewModel();
diff --git a/sbbs-client-wp7.csproj b/sbbs-client-wp7.csproj
index 4c695a3..1005e0b 100644
--- a/sbbs-client-wp7.csproj
+++ b/sbbs-client-wp7.csproj
@@ -68,6 +68,9 @@
BoardPage.xaml
+
+ BoardSettingsPage.xaml
+
@@ -117,6 +120,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
@@ -169,9 +176,11 @@
+
+