12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ShakerManger.Tools
- {
- public static class DispatherInovke
- {
- public static void Inovke(Action action)
- {
- try
- {
- if (action == null) return;
- if (App.Current.Dispatcher.Thread == Thread.CurrentThread)
- {
- action();
- }
- else
- {
- App.Current?.Dispatcher?.Invoke(action);
- }
- }
- catch
- {
- }
- }
- //public static void Inovke(this Action action)
- //{
- // if (action == null) return;
- // if (App.Current.Dispatcher.Thread == Thread.CurrentThread)
- // {
- // action();
- // }
- // else
- // {
- // App.Current?.Dispatcher?.Invoke(action);
- // }
- //}
- }
- }
|