Skip to content

Commit

Permalink
各项小优化
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Mar 14, 2012
1 parent b52d45b commit bd140cd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 58 deletions.
6 changes: 4 additions & 2 deletions LoginPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<!--Pivot Control-->
<controls:Pivot Title="虎踞龙蟠BBS">
<controls:Pivot x:Name="LoginPivot" Title="虎踞龙蟠BBS">
<!--Pivot item one-->
<controls:PivotItem Header="登录">
<StackPanel>
Expand All @@ -64,7 +64,9 @@

<!--Pivot item two-->
<controls:PivotItem Header="注册">
<Grid/>
<ScrollViewer>
<TextBlock Text="未完成" HorizontalAlignment="Center" Style="{StaticResource PhoneTextExtraLargeStyle}" />
</ScrollViewer>
</controls:PivotItem>
</controls:Pivot>
</Grid>
Expand Down
11 changes: 11 additions & 0 deletions LoginPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Navigation;

namespace sbbs_client_wp7
{
Expand All @@ -22,6 +23,16 @@ public LoginPage()
DataContext = App.ViewModel;
}

protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);

if (NavigationContext.QueryString.ContainsKey("reg"))
{
LoginPivot.SelectedIndex = 1;
}
}

private void Login_Click(object sender, RoutedEventArgs e)
{
App.ViewModel.IsLogining = true;
Expand Down
26 changes: 16 additions & 10 deletions MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,14 @@
<controls:PanoramaItem.Header>
<TextBlock motion:MetroInMotion.Tilt="6" Tap="RefreshFavorates_Tap" Text="收藏夹" Foreground="{StaticResource PhoneAccentBrush}" FontSize="60"/>
</controls:PanoramaItem.Header>
<custom:RecursiveListBox ItemsSource="{Binding FavoratesItems}" ItemTemplate="{StaticResource BoardDataTemplate}"
LeafItemTap="Favorates_Selected"/>
<Grid>
<custom:RecursiveListBox ItemsSource="{Binding FavoratesItems}" ItemTemplate="{StaticResource BoardDataTemplate}"
Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}}"
LeafItemTap="Favorates_Selected"/>
<TextBlock Text="请在登录后使用收藏夹"
Opacity="0.7" FontSize="{StaticResource PhoneFontSizeLarge}"
Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}, ConverterParameter=true}"/>
</Grid>
</controls:PanoramaItem>

<!-- 我的账户 -->
Expand All @@ -93,16 +99,16 @@
</Style>
</toolkit:WrapPanel.Resources>

<local:Tile Title="分区热点" Tap="HotTopics_Tap" Src="/Images/Tiles/board.png"/>
<local:Tile Title="热门版面" Tap="HotBoards_Tap" Src="/Images/Tiles/list.png"/>
<local:Tile Title="版面分区" Tap="Sections_Tap" Src="/Images/Tiles/folder.png"/>
<local:Tile Title="分区热点" Tag="HotPage.xaml?type=0" Tap="Tile_Tap" Src="/Images/Tiles/board.png"/>
<local:Tile Title="热门版面" Tag="HotPage.xaml?type=1" Tap="Tile_Tap" Src="/Images/Tiles/list.png"/>
<local:Tile Title="版面分区" Tag="HotPage.xaml?type=2" Tap="Tile_Tap" Src="/Images/Tiles/folder.png"/>
<!--<local:Tile Title="最近浏览" Tap="History_Tap" Src="/Images/Tiles/history.png"/>-->
<local:Tile Title="站内信" Tap="Mail_Tap" Src="/Images/Tiles/mailbox.png" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}}"/>
<local:Tile Title="站内信" Tag="MailboxPage.xaml?type=0" Tap="Tile_Tap" Src="/Images/Tiles/mailbox.png" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}}"/>
<!--<local:Tile Title="搜索" Tap="Search_Tap" Src="/Images/Tiles/search.png"/>-->
<local:Tile Title="关于" Tap="About_Tap" Src="/Images/Tiles/love.png"/>
<local:Tile Title="登录" Src="/Images/Tiles/pen.png" Tap="Login_Tap" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}, ConverterParameter=True}"/>
<local:Tile Title="注册" Src="/Images/Tiles/cup.png" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}, ConverterParameter=True}"/>
<local:Tile Title="退出" Src="/Images/Tiles/pen.png" Tap="Logout_Tap" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}}"/>
<local:Tile Title="关于" Tag="AboutPage.xaml" Tap="Tile_Tap" Src="/Images/Tiles/love.png"/>
<local:Tile Title="登录" Tag="LoginPage.xaml" Src="/Images/Tiles/pen.png" Tap="Tile_Tap" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}, ConverterParameter=True}"/>
<local:Tile Title="注册" Tag="LoginPage.xaml?reg=1" Src="/Images/Tiles/cup.png" Tap="Tile_Tap" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}, ConverterParameter=True}"/>
<local:Tile Title="退出" Src="/Images/Tiles/pen.png" Tap="Logout_Tap" Visibility="{Binding IsLogin, Converter={StaticResource BoolVisibleConverter}}"/>
</toolkit:WrapPanel>
</controls:PanoramaItem>
</controls:Panorama>
Expand Down
49 changes: 3 additions & 46 deletions MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ private void MainPage_Loaded(object sender, RoutedEventArgs e)
}
}

// 登录
private void Login_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
this.NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative));
}

// 注销
private void Logout_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
Expand All @@ -88,46 +82,10 @@ private void RefreshFavorates_Tap(object sender, System.Windows.Input.GestureEve
App.ViewModel.IsFavoratesLoaded = false;
LoadFavorates();
}

// 分区热点
private void HotTopics_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/HotPage.xaml?type=0", UriKind.RelativeOrAbsolute));
}

// 热门版面
private void HotBoards_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/HotPage.xaml?type=1", UriKind.RelativeOrAbsolute));
}

// 版面分区
private void Sections_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/HotPage.xaml?type=2", UriKind.RelativeOrAbsolute));
}

// 我的邮箱
private void Mail_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/MailboxPage.xaml?type=0", UriKind.RelativeOrAbsolute));
}

// 搜索
private void Search_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/SearchPage.xaml", UriKind.RelativeOrAbsolute));
}

// 浏览历史
private void History_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
}

// 关于
private void About_Tap(object sender, System.Windows.Input.GestureEventArgs e)

private void Tile_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
NavigationService.Navigate(new Uri("/AboutPage.xaml", UriKind.RelativeOrAbsolute));
NavigationService.Navigate(new Uri("/" + (sender as Tile).Tag, UriKind.Relative));
}

// 点击收藏夹
Expand Down Expand Up @@ -159,7 +117,6 @@ private void Topten_Selected(object sender, SelectionChangedEventArgs e)
// 载入收藏夹
private void LoadFavorates()
{
MessageBox.Show("IsLogin: " + App.ViewModel.IsLogin);
// 登录时载入收藏夹,未登陆时清空
if (App.ViewModel.IsLogin)
{
Expand Down

0 comments on commit bd140cd

Please sign in to comment.