Пример #1
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.
 /// This parameter is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     joke = e.Parameter as Models.JokeModel;
     contentViewer.DataContext = joke;
     jokeContent = joke.content;
     index       = MainPage.jokes.IndexOf(joke);
     if (index == -1)
     {
         throw new ArgumentException("参数错误");
     }
     //if (index == 0)
     //{
     //    appbarBack.IsEnabled = false;
     //}
     //else
     //{
     //    appbarBack.IsEnabled = true;
     //}
     //if (index == maxIndex)
     //{
     //    appbarForward.IsEnabled = false;
     //}
     //else
     //{
     //    appbarForward.IsEnabled = true;
     //}
 }
Пример #2
0
        /// <summary>
        /// 返回主页 Navigate to homepage
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void appbarHome_Click(object sender, RoutedEventArgs e)
        {
            string tag = (sender as AppBarButton).Tag.ToString();

            if (tag.Equals("Next"))
            {
                index += 1;
                joke   = MainPage.jokes[index];
            }
            else
            {
                index -= 1;
            }
            contentViewer.DataContext = joke;
            jokeContent = joke.content;

            if (index == 0)
            {
                appbarBack.IsEnabled = false;
            }
            else
            {
                appbarBack.IsEnabled = true;
            }
            if (index == maxIndex)
            {
                appbarForward.IsEnabled = false;
            }
            else
            {
                appbarForward.IsEnabled = true;
            }
        }
Пример #3
0
 private void lvJokes_ItemClick(object sender, ItemClickEventArgs e)
 {
     Models.JokeModel model = e.ClickedItem as Models.JokeModel;
     Frame.Navigate(typeof(DetailsPage), model);
 }