forked from zcbenz/sbbs-client-wp7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoardSettingsPage.xaml.cs
58 lines (50 loc) · 1.58 KB
/
BoardSettingsPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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);
// 恢复选择
ignoreSelection = true;
Mode.SelectedIndex = App.Service.BoardMode % 3;
}
private bool ignoreSelection = true; // 永远忽略第一次选择(由系统触发)
private void Mode_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// 设置标记忽略事件
if (ignoreSelection)
{
ignoreSelection = false;
return;
}
ListPicker list = sender as ListPicker;
// 设置并保存模式
int mode = list.SelectedIndex;
if (mode != App.Service.BoardMode)
{
App.Service.BoardMode = mode;
LocalCache.Set<int>("BoardMode", App.Service.BoardMode);
// 刷新版面以生效
App.ViewModel.CurrentBoard.NeedRefresh = true;
}
}
}
}