private static void ThrowIfNoThread() { if (uiThread.NullReference()) { throw new InvalidOperationException("UI thread is unknown! Use UI.Set to specify it."); } }
/// <summary> /// Specifies the UI thread to use. /// May only set once at most. /// </summary> /// <param name="thread">The <see cref="IUIThread"/> to use.</param> public static void Set(IUIThread thread) { if (thread.NullReference()) { throw Exc.Null(nameof(thread)); } var previousValue = Interlocked.CompareExchange(ref uiThread, thread, comparand: null); if (previousValue.NotNullReference()) { throw new InvalidOperationException("UI already initialized!").StoreFileLine(); } }