private void Stack3_HoverClick(object sender, HandInputEventArgs e) { Stack3.Visibility = Visibility.Visible; Stack2.Visibility = Visibility.Collapsed; Stack1.Visibility = Visibility.Collapsed; this.ContentScrollViewer.ScrollToTop(); SpeechMediaElement.Source = new Uri(@"3_前身.mp3", UriKind.Relative); SpeechMediaElement.Play(); }
private void JingJuButtonClick(object sender, HandInputEventArgs e) { SpeechMediaElement.Source = new Uri(@"8_京剧比较.mp3", UriKind.Relative); SpeechMediaElement.Play(); 越剧文字底.Visibility = Visibility.Hidden; 越剧1.Visibility = Visibility.Hidden; 京剧文字底.Visibility = Visibility.Visible; 京剧1.Visibility = Visibility.Visible; Storyboard storyboard = (Storyboard)this.FindResource("JingJuScale"); storyboard.Begin(this); }
/// <summary> /// 利用StackPanel的特点,让功能先判断当前界面内容之后显示相应内容. /// </summary> /// <param name="selectedItem"></param> /// <param name="duration"></param> public void AnimateIn(int selectedItem, Duration duration) { var sb = new Storyboard(); var animateOpacity = new DoubleAnimation(0, 1, duration); Storyboard.SetTarget(animateOpacity, this); Storyboard.SetTargetProperty(animateOpacity, new PropertyPath("Opacity")); sb.Children.Add(animateOpacity); if (selectedItem == 1) { _3_1起源.Opacity = 1; _3_1起源.IsHitTestVisible = true; _3_2发展.Opacity = 0; _3_2发展.IsHitTestVisible = false; _3_3兴盛.Opacity = 0; _3_3兴盛.IsHitTestVisible = false; _3_4衰落.Opacity = 0; _3_4衰落.IsHitTestVisible = false; _3_5复兴.Opacity = 0; _3_5复兴.IsHitTestVisible = false; Storyboard storyboard = (Storyboard)this.FindResource("onGoing1"); storyboard.Begin(this); Stack1.Visibility = Visibility.Visible; Stack2.Visibility = Visibility.Collapsed; Stack3.Visibility = Visibility.Collapsed; Stack4.Visibility = Visibility.Collapsed; Stack5.Visibility = Visibility.Collapsed; Stack6.Visibility = Visibility.Collapsed; Stack7.Visibility = Visibility.Collapsed; SpeechMediaElement.Source = new Uri(@"1_起源地.mp3", UriKind.Relative); SpeechMediaElement.Play(); } else if (selectedItem == 2) { _3_1起源.Opacity = 0; _3_1起源.IsHitTestVisible = false; _3_2发展.Opacity = 1; _3_2发展.IsHitTestVisible = true; _3_3兴盛.Opacity = 0; _3_3兴盛.IsHitTestVisible = false; _3_4衰落.Opacity = 0; _3_4衰落.IsHitTestVisible = false; _3_5复兴.Opacity = 0; _3_5复兴.IsHitTestVisible = false; Storyboard storyboard = (Storyboard)this.FindResource("onGoing2"); storyboard.Begin(this); Stack1.Visibility = Visibility.Collapsed; Stack2.Visibility = Visibility.Collapsed; Stack3.Visibility = Visibility.Collapsed; Stack4.Visibility = Visibility.Visible; Stack5.Visibility = Visibility.Collapsed; Stack6.Visibility = Visibility.Collapsed; Stack7.Visibility = Visibility.Collapsed; SpeechMediaElement.Source = new Uri(@"4_发展.mp3", UriKind.Relative); SpeechMediaElement.Play(); } else if (selectedItem == 3) { _3_1起源.Opacity = 0; _3_1起源.IsHitTestVisible = false; _3_2发展.Opacity = 0; _3_2发展.IsHitTestVisible = false; _3_3兴盛.Opacity = 1; _3_3兴盛.IsHitTestVisible = true; _3_4衰落.Opacity = 0; _3_4衰落.IsHitTestVisible = false; _3_5复兴.Opacity = 0; _3_5复兴.IsHitTestVisible = false; Storyboard storyboard = (Storyboard)this.FindResource("onGoing3"); storyboard.Begin(this); Stack1.Visibility = Visibility.Collapsed; Stack2.Visibility = Visibility.Collapsed; Stack3.Visibility = Visibility.Collapsed; Stack4.Visibility = Visibility.Collapsed; Stack5.Visibility = Visibility.Visible; Stack6.Visibility = Visibility.Collapsed; Stack7.Visibility = Visibility.Collapsed; SpeechMediaElement.Source = new Uri(@"5_兴盛.mp3", UriKind.Relative); SpeechMediaElement.Play(); } else if (selectedItem == 4) { _3_1起源.Opacity = 0; _3_1起源.IsHitTestVisible = false; _3_2发展.Opacity = 0; _3_2发展.IsHitTestVisible = false; _3_3兴盛.Opacity = 0; _3_3兴盛.IsHitTestVisible = false; _3_4衰落.Opacity = 1; _3_4衰落.IsHitTestVisible = true; _3_5复兴.Opacity = 0; _3_5复兴.IsHitTestVisible = false; Storyboard storyboard = (Storyboard)this.FindResource("onGoing4"); storyboard.Begin(this); Stack1.Visibility = Visibility.Collapsed; Stack2.Visibility = Visibility.Collapsed; Stack3.Visibility = Visibility.Collapsed; Stack4.Visibility = Visibility.Collapsed; Stack5.Visibility = Visibility.Collapsed; Stack6.Visibility = Visibility.Visible; Stack7.Visibility = Visibility.Collapsed; SpeechMediaElement.Source = new Uri(@"6_衰败.mp3", UriKind.Relative); SpeechMediaElement.Play(); } else if (selectedItem == 5) { _3_1起源.Opacity = 0; _3_1起源.IsHitTestVisible = false; _3_2发展.Opacity = 0; _3_2发展.IsHitTestVisible = false; _3_3兴盛.Opacity = 0; _3_3兴盛.IsHitTestVisible = false; _3_4衰落.Opacity = 0; _3_4衰落.IsHitTestVisible = false; _3_5复兴.Opacity = 1; _3_5复兴.IsHitTestVisible = true; Storyboard storyboard = (Storyboard)this.FindResource("onGoing5"); storyboard.Begin(this); Stack1.Visibility = Visibility.Collapsed; Stack2.Visibility = Visibility.Collapsed; Stack3.Visibility = Visibility.Collapsed; Stack4.Visibility = Visibility.Collapsed; Stack5.Visibility = Visibility.Collapsed; Stack6.Visibility = Visibility.Collapsed; Stack7.Visibility = Visibility.Visible; SpeechMediaElement.Source = new Uri(@"7_复兴.mp3", UriKind.Relative); SpeechMediaElement.Play(); } this.ContentScrollViewer.ScrollToTop(); this.IsHitTestVisible = true; sb.Begin(); }