WpfSysCmd.cs 752 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Threading;
  7. namespace FWindSoft.Wpf
  8. {
  9. /// <summary>
  10. /// 系统需求相关命令
  11. /// </summary>
  12. public static class WpfSysCmd
  13. {
  14. public static void DoEvent()
  15. {
  16. DispatcherFrame frame = new DispatcherFrame();
  17. Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
  18. new DispatcherOperationCallback(ExitFrame), frame);
  19. Dispatcher.PushFrame(frame);
  20. }
  21. private static object ExitFrame(object f)
  22. {
  23. ((DispatcherFrame)f).Continue = false;
  24. return null;
  25. }
  26. }
  27. }