Beispiel #1
0
 public static async ValueTask <ThreadSafeForm <T> > GetAsync(Func <CancellationToken, T> funcFormConstructor, CancellationToken token = default)
 {
     return(new ThreadSafeForm <T>(Program.MainForm != null
                                      ? await Program.MainForm.DoThreadSafeFuncAsync(funcFormConstructor, token)
                                      : await Utils.StartStaTask(() => funcFormConstructor.Invoke(token),
                                                                 token)));
 }
Beispiel #2
0
 public static ThreadSafeForm <T> Get(Func <T> funcFormConstructor)
 {
     return(new ThreadSafeForm <T>(Program.MainForm != null
                                      ? Program.MainForm.DoThreadSafeFunc(funcFormConstructor)
                                      : Utils.RunWithoutThreadLock(() => Utils.StartStaTask(funcFormConstructor))));
 }