internal static Dispatcher GetDispatcher(DispatcherOption dispatcherOption)
        {
            Dispatcher dispatcher;

            switch (dispatcherOption)
            {
            case DispatcherOption.CurrentThread:
                dispatcher = Dispatcher.CurrentDispatcher;
                break;

            case DispatcherOption.CurrentApplication:
                dispatcher = Application.Current.Dispatcher;
                break;

            case DispatcherOption.Custom:
                dispatcher = GetCustomDispatcher();
                break;

            default:
                throw new InvalidOperationException();
            }

            return(dispatcher);
        }
        public static bool CheckDispatcherAccess(DispatcherOption dispatcherOption)
        {
            var dispatcher = GetDispatcher(dispatcherOption);

            return(dispatcher.CheckAccess());
        }
 public static void SetDefaultDispatcher(DispatcherOption dispatcherOption)
 {
     DefaultDispatcher = dispatcherOption;
 }
 static MaterialApplication()
 {
     DefaultDispatcher = DispatcherOption.CurrentThread;
 }
 public WindowSession ShowTracked(DispatcherOption dispatcherOption)
 {
     return(new WindowSession(this, MaterialApplication.GetDispatcher(dispatcherOption)).Show());
 }
 public Task <bool?> Show(DispatcherOption dispatcherOption) => ShowTracked(dispatcherOption).Task;