星火微课系统客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CountdownWindow.xaml.cs 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using AForge.Imaging;
  2. using Common.system;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. using System.Windows;
  10. using System.Windows.Controls;
  11. using System.Windows.Data;
  12. using System.Windows.Documents;
  13. using System.Windows.Input;
  14. using System.Windows.Media;
  15. using System.Windows.Media.Imaging;
  16. using System.Windows.Shapes;
  17. using System.Windows.Threading;
  18. namespace XHWK.WKTool
  19. {
  20. /// <summary>
  21. /// CountdownWindow.xaml 的交互逻辑
  22. /// </summary>
  23. public partial class CountdownWindow : Window
  24. {
  25. DispatcherTimer timer = null;
  26. public CountdownWindow()
  27. {
  28. InitializeComponent();
  29. Initialize();
  30. }
  31. public void Initialize()
  32. {
  33. //Thread.Sleep(1200);
  34. //this.Hide();
  35. //MediaElement.Position
  36. //((MediaElement)((object)ImgGif)).Position= TimeSpan.Zero;
  37. timer = new DispatcherTimer();
  38. timer.Interval = TimeSpan.FromMilliseconds(2500);
  39. timer.Tick += Timer_Tick;
  40. timer.Start();
  41. }
  42. private void Timer_Tick(object sender, EventArgs e)
  43. {
  44. this.Hide();
  45. timer.Stop();
  46. }
  47. /// <summary>
  48. /// 跳转页面
  49. /// </summary>
  50. /// <param name="sender"></param>
  51. /// <param name="e"></param>
  52. private void Window_ContentRendered(object sender, EventArgs e)
  53. {
  54. //Thread.Sleep(800);
  55. ////imgLoding.Source= new BitmapImage(new Uri("pack://application:,,/Images/countdown_2.png"));
  56. ////Thread.Sleep(300);
  57. ////imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown_1.png"));
  58. ////Thread.Sleep(300);
  59. //this.Hide();
  60. //Initialize();
  61. }
  62. private void Image_MediaEnded(object sender, RoutedEventArgs e)
  63. {
  64. System.Windows.Controls.Image img = (System.Windows.Controls.Image)sender;
  65. ((MediaElement)sender).Position = ((MediaElement)sender).Position.Add(TimeSpan.FromMilliseconds(10000));
  66. }
  67. }
  68. }