private PhotinoSynchronizationContext(PhotinoWindow window, State state)
    {
        _state = state;

        _window = window ?? throw new ArgumentNullException(nameof(window));

        _uiThreadId = (int)_window.GetType()
                      .GetField("_managedThreadId", BindingFlags.NonPublic | BindingFlags.Instance) !
                      .GetValue(_window) !;

        _invokeMethodInfo = _window.GetType()
                            .GetMethod("Invoke", BindingFlags.NonPublic | BindingFlags.Instance) !;
    }