diff --git a/Tile.xaml b/Controls/Tile.xaml
similarity index 100%
rename from Tile.xaml
rename to Controls/Tile.xaml
diff --git a/Tile.xaml.cs b/Controls/Tile.xaml.cs
similarity index 100%
rename from Tile.xaml.cs
rename to Controls/Tile.xaml.cs
diff --git a/MailboxPage.xaml b/MailboxPage.xaml
index b3f58b6..62ac2a5 100644
--- a/MailboxPage.xaml
+++ b/MailboxPage.xaml
@@ -64,36 +64,54 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/MailboxPage.xaml.cs b/MailboxPage.xaml.cs
index cf60752..d9f201e 100644
--- a/MailboxPage.xaml.cs
+++ b/MailboxPage.xaml.cs
@@ -28,13 +28,21 @@ private void SetLoading()
App.ViewModel.Mailbox.IsLoading = isLoading[0] | isLoading[1] | isLoading[2];
}
+ // 载入按钮集合
+ Button[] LoadMore = { null, null, null };
+
public MailboxPage()
{
InitializeComponent();
if (App.ViewModel.Mailbox == null)
App.ViewModel.Mailbox = new MailboxViewModel();
+
DataContext = App.ViewModel.Mailbox;
+
+ LoadMore[0] = LoadMore1;
+ LoadMore[1] = LoadMore2;
+ LoadMore[2] = LoadMore3;
}
// 进入页面时根据参数切换到指定的页面
@@ -82,28 +90,65 @@ private void Mail_Selected(object sender, SelectionChangedEventArgs e)
}
// 加载指定的信箱
- private void LoadMailbox(int type)
+ private void LoadMailbox(int type, bool append = false)
{
isLoading[type] = true;
SetLoading();
- App.Service.MailBox(type, currentPage * pageSize, pageSize, delegate(ObservableCollection mails, bool success, string error)
+ int loadPage = append ? currentPage + 1 : currentPage;
+ App.Service.MailBox(type, loadPage * pageSize, pageSize, delegate(ObservableCollection mails, bool success, string error)
{
isLoading[type] = false;
SetLoading();
if (mails != null)
{
- switch (type)
+ // 直接覆盖
+ if (!append)
{
- case 0:
- App.ViewModel.Mailbox.InboxItems = mails;
- break;
- case 1:
- App.ViewModel.Mailbox.SentItems = mails;
- break;
- case 2:
- App.ViewModel.Mailbox.DeletedItems = mails;
- break;
+ switch (type)
+ {
+ case 0:
+ App.ViewModel.Mailbox.InboxItems = mails;
+ break;
+ case 1:
+ App.ViewModel.Mailbox.SentItems = mails;
+ break;
+ case 2:
+ App.ViewModel.Mailbox.DeletedItems = mails;
+ break;
+ }
+ }
+ // 或者接在后面
+ else
+ {
+ switch (type)
+ {
+ case 0:
+ foreach (TopicViewModel mail in mails)
+ App.ViewModel.Mailbox.InboxItems.Add(mail);
+ break;
+ case 1:
+ foreach (TopicViewModel mail in mails)
+ App.ViewModel.Mailbox.SentItems.Add(mail);
+ break;
+ case 2:
+ foreach (TopicViewModel mail in mails)
+ App.ViewModel.Mailbox.DeletedItems.Add(mail);
+ break;
+ }
+ ++currentPage;
+ }
+
+ // 判断是否显示下一页
+ if (mails.Count < pageSize)
+ {
+ LoadMore[type].Visibility = Visibility.Collapsed;
+ LoadMore[type].IsEnabled = false;
+ }
+ else
+ {
+ LoadMore[type].Visibility = Visibility.Visible;
+ LoadMore[type].IsEnabled = true;
}
}
});
@@ -112,7 +157,14 @@ private void LoadMailbox(int type)
// 刷新按钮
private void Refresh_Click(object sender, EventArgs e)
{
+ currentPage = 0;
LoadMailbox(MailboxPivot.SelectedIndex);
}
+
+ // 载入更多
+ private void LoadMore_Click(object sender, RoutedEventArgs e)
+ {
+ LoadMailbox(MailboxPivot.SelectedIndex, true);
+ }
}
}
\ No newline at end of file
diff --git a/ValueConverters/StampDateConverter.cs b/ValueConverters/StampDateConverter.cs
index bf2b093..c5f0c73 100644
--- a/ValueConverters/StampDateConverter.cs
+++ b/ValueConverters/StampDateConverter.cs
@@ -24,9 +24,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
if (date.Year == now.Year && date.Month == now.Month && date.Day == now.Day)
return date.ToString("HH:mm", culture);
else if (date.Year == now.Year)
- return date.ToString("MM月d日 HH:mm", culture);
+ return date.ToString("M月d日 HH:mm", culture);
else
- return date.ToString("yyyy年MM月d日", culture);
+ return date.ToString("yyyy年M月d日", culture);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
diff --git a/sbbs-client-wp7.csproj b/sbbs-client-wp7.csproj
index 87a2574..1583abe 100644
--- a/sbbs-client-wp7.csproj
+++ b/sbbs-client-wp7.csproj
@@ -100,7 +100,7 @@
SettingsPage.xaml
-
+
Tile.xaml
@@ -169,7 +169,7 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile