예제 #1
0
        private void RestoreProfile()
        {
            WlanProfileList list = new WlanProfileList();

            this._device.WiFiProfilesSentEvent += new FallibleEventHandler(this.Device_RestoreDeviceWlanProfilesCompleteEvent);
            if (this._deviceProfile != null)
            {
                list.Add(this._deviceProfile);
            }
            if (this._device.SetWiFiProfileList(list).IsSuccess)
            {
                this._device.SendWiFiProfiles();
            }
            this._restore.WaitOne(5000, false);
            this._device.WiFiProfilesSentEvent -= new FallibleEventHandler(this.Device_RestoreDeviceWlanProfilesCompleteEvent);
        }
예제 #2
0
        protected override WirelessStateResults DoStep(WirelessStates state)
        {
            HRESULT hr;

            switch (state)
            {
            case WirelessStates.CommitProfileToDevice:
                WlanProfileList list = new WlanProfileList();
                list.Add(this._attemptingProfile);
                hr = this._device.SetWiFiProfileList(list);
                if (hr.IsSuccess)
                {
                    hr = this._device.SendWiFiProfiles();
                    break;
                }
                break;

            case WirelessStates.TestDeviceProfile:
                hr = this._device.TestWiFi();
                break;

            case WirelessStates.GetDeviceProfiles:
                hr = this._device.ReceiveWiFiProfiles();
                break;

            case WirelessStates.AssociateWlanDevice:
                hr = this._device.AssociateWiFi();
                break;

            default:
                hr = HRESULT._E_ABORT;
                break;
            }
            if (hr.IsSuccess)
            {
                return(WirelessStateResults.Success);
            }
            this.SetResult(hr);
            return(WirelessStateResults.Error);
        }