Exemplo n.º 1
0
        private void Register(NativeMethods.RASCN changeType, RasHandle handle)
        {
            AutoResetEvent waitObject = new AutoResetEvent(false);

            int ret = SafeNativeMethods.Instance.RegisterConnectionNotification(handle, waitObject.SafeWaitHandle, changeType);

            if (ret == NativeMethods.SUCCESS)
            {
                RasConnectionWatcherStateObject stateObject = new RasConnectionWatcherStateObject(changeType);

                stateObject.WaitObject = waitObject;
                stateObject.WaitHandle = ThreadPool.RegisterWaitForSingleObject(waitObject, new WaitOrTimerCallback(this.ConnectionStateChanged), stateObject, Timeout.Infinite, false);

                this._stateObjects.Add(stateObject);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RasConnectionWatcherStateObject"/> class.
 /// </summary>
 /// <param name="changeType">The change type being monitored.</param>
 public RasConnectionWatcherStateObject(NativeMethods.RASCN changeType)
 {
     this._changeType = changeType;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RasConnectionWatcherStateObject"/> class.
 /// </summary>
 /// <param name="changeType">The change type being monitored.</param>
 public RasConnectionWatcherStateObject(NativeMethods.RASCN changeType)
 {
     this._changeType = changeType;
 }