public void Subscribe(RasNotificationContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            GuardMustNotBeDisposed();

            lock (SyncRoot)
            {
                callbackHandler.Initialize();

                // Connection events always needs an invalid handle.
                RegisterCallback(INVALID_HANDLE_VALUE, context.OnConnectedCallback, RASCN.Connection);

                var handle = DetermineHandleForSubscribe(context);
                RegisterCallback(handle, context.OnDisconnectedCallback, RASCN.Disconnection);
            }
        }
 private IntPtr DetermineHandleForSubscribe(RasNotificationContext context)
 {
     return(context.Connection?.Handle ?? INVALID_HANDLE_VALUE);
 }