XNAFrameworkDispatcherService.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Net;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Documents;
  6. using System.Windows.Ink;
  7. using System.Windows.Input;
  8. using System.Windows.Media;
  9. using System.Windows.Media.Animation;
  10. using System.Windows.Shapes;
  11. using System.Windows.Threading;
  12. using Microsoft.Xna.Framework;
  13. namespace VocabManager.Voice
  14. {
  15. public class XNAFrameworkDispatcherService : IApplicationService
  16. {
  17. private DispatcherTimer frameworkDispatcherTimer;
  18. public XNAFrameworkDispatcherService()
  19. {
  20. this.frameworkDispatcherTimer = new DispatcherTimer();
  21. this.frameworkDispatcherTimer.Interval = TimeSpan.FromTicks(333333);
  22. this.frameworkDispatcherTimer.Tick += frameworkDispatcherTimer_Tick;
  23. FrameworkDispatcher.Update();
  24. }
  25. void frameworkDispatcherTimer_Tick(object sender, EventArgs e)
  26. { FrameworkDispatcher.Update(); }
  27. void IApplicationService.StartService(ApplicationServiceContext context)
  28. { this.frameworkDispatcherTimer.Start(); }
  29. void IApplicationService.StopService() { this.frameworkDispatcherTimer.Stop(); }
  30. }
  31. }