From bd140cd503548dd4bc4d170fcd9dfe215301c0f4 Mon Sep 17 00:00:00 2001 From: Zhao Cheng Date: Wed, 14 Mar 2012 20:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=84=E9=A1=B9=E5=B0=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LoginPage.xaml | 6 ++++-- LoginPage.xaml.cs | 11 +++++++++++ MainPage.xaml | 26 +++++++++++++++---------- MainPage.xaml.cs | 49 +++-------------------------------------------- 4 files changed, 34 insertions(+), 58 deletions(-) diff --git a/LoginPage.xaml b/LoginPage.xaml index dceb2dd..f2697d6 100644 --- a/LoginPage.xaml +++ b/LoginPage.xaml @@ -41,7 +41,7 @@ - + @@ -64,7 +64,9 @@ - + + + diff --git a/LoginPage.xaml.cs b/LoginPage.xaml.cs index 1d7dc35..8161acc 100644 --- a/LoginPage.xaml.cs +++ b/LoginPage.xaml.cs @@ -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 { @@ -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; diff --git a/MainPage.xaml b/MainPage.xaml index 4106817..a022d0a 100644 --- a/MainPage.xaml +++ b/MainPage.xaml @@ -77,8 +77,14 @@ - + + + + @@ -93,16 +99,16 @@ - - - + + + - + - - - - + + + + diff --git a/MainPage.xaml.cs b/MainPage.xaml.cs index 6d20906..9edeb99 100644 --- a/MainPage.xaml.cs +++ b/MainPage.xaml.cs @@ -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) { @@ -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)); } // 点击收藏夹 @@ -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) {