Exemplo n.º 1
0
 protected override void EndOperation(WirelessStateResults result)
 {
     Dictionary<string, WlanProfile> dictionary = new Dictionary<string, WlanProfile>();
     if (this._deviceNetworks != null)
     {
         foreach (WlanProfile deviceNetwork in _deviceNetworks)
         {
             if (!dictionary.ContainsKey(deviceNetwork.SSID))
             {
                 WlanProfile wlanProfile = deviceNetwork;
                 foreach (WlanProfile computerNetwork in _computerNetworks)
                 {
                     if (computerNetwork.SSID == deviceNetwork.SSID)
                     {
                         wlanProfile = computerNetwork;
                         break;
                     }
                 }
                 if (!wlanProfile.Connected)
                     wlanProfile.Key = string.Empty;
                 dictionary.Add(wlanProfile.SSID, wlanProfile);
                 this._networkList.Add(wlanProfile);
             }
         }
     }
     this._networkList.Sort(new WlanSignalStrenghComparer());
 }
Exemplo n.º 2
0
        protected WirelessStateResults StartOperation(
            UIDevice device,
            AOComplete completeFunc,
            WirelessStates[] states)
        {
            WirelessStateResults result = WirelessStateResults.Error;

            if (!this.Idle)
            {
                return(WirelessStateResults.NotAvailable);
            }
            this.ResetState();
            this._device       = device;
            this._states       = states;
            this._completeFunc = completeFunc;
            _iCurrentState     = 0;
            if (device.IsConnectedToClient)
            {
                this.AddListenersInternal();
                result = this.DoNextStep();
            }
            if (result != WirelessStateResults.Success)
            {
                this.EndOperationInternal(result);
            }
            return(WirelessStateResults.Success);
        }
Exemplo n.º 3
0
 protected override void EndOperation(WirelessStateResults result)
 {
     if (result != WirelessStateResults.Finished)
     {
         if (this._fProfileSaved)
         {
             this.RestoreProfile();
         }
         if (result == WirelessStateResults.Canceled)
         {
             this._error         = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_CANCELED);
             this._detailedError = null;
             this._hr            = HRESULT._S_OK;
         }
         else if (this._attemptingProfile != null)
         {
             this._error = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED), _attemptingProfile.SSID);
         }
         else
         {
             this._error = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED_GENERIC);
         }
     }
     else if (!string.IsNullOrEmpty(this._wlanTestResult))
     {
         this._error         = string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_TEST_FAILED), _attemptingProfile.SSID);
         this._detailedError = this._wlanTestResult;
         this._hr            = this._wlanTestResultCode;
     }
     else
     {
         SQMLog.Log(SQMDataId.DeviceWirelessSetup, 1);
     }
 }
Exemplo n.º 4
0
        public WirelessStateResults RequestWirelessNetworksList()
        {
            this.wirelessDeviceErrorDescription = null;
            this.wirelessDeviceErrorCaption     = Shell.LoadString(StringId.IDS_WIRELESS_SNIFF_FAILED);
            this.wirelessDeviceErrorCode        = HRESULT._S_OK;
            WirelessStateResults result = this.wirelessGetNetworkListHelper.StartOperation(this.ActiveDevice, new AsyncOperation.AOComplete(this.GetNetworkListDone));

            this.WirelessHandleDeviceBusy(result);
            return(result);
        }
Exemplo n.º 5
0
 protected void StepComplete(WirelessStateResults result)
 {
     ++_iCurrentState;
     if (result == WirelessStateResults.Success)
     {
         result = this.DoNextStep();
     }
     if (result == WirelessStateResults.Success)
     {
         return;
     }
     this.EndOperationInternal(result);
 }
Exemplo n.º 6
0
 private void EndOperationInternal(WirelessStateResults result)
 {
     this.RemoveListenersInternal();
     if (result == WirelessStateResults.Canceled)
     {
         this._fCanceled = true;
     }
     this.EndOperation(result);
     _iCurrentState = -2;
     if (this._completeFunc != null)
     {
         this._completeFunc(result == WirelessStateResults.Finished);
     }
     _iCurrentState = -1;
 }
Exemplo n.º 7
0
 protected override void EndOperation(WirelessStateResults result)
 {
     this._connectedNetwork = null;
     if (this._computerProfiles == null)
     {
         return;
     }
     foreach (WlanProfile computerProfile in _computerProfiles)
     {
         if (computerProfile.Connected)
         {
             this._connectedNetwork = computerProfile;
             break;
         }
     }
 }
Exemplo n.º 8
0
        public WirelessStateResults SetWirelessSettings()
        {
            WirelessStateResults result = WirelessStateResults.Error;
            WlanProfile          wirelessProfileToSave = this.wirelessProfileToSave;

            this.wirelessDeviceErrorDescription = null;
            this.wirelessDeviceErrorCaption     = Shell.LoadString(StringId.IDS_WIRELESS_SYNC_POST_SETUP_FAILED);
            this.wirelessDeviceErrorCode        = HRESULT._S_OK;
            this.wirelessDeviceCanceled         = false;
            if (wirelessProfileToSave != null)
            {
                result = this.wirelessSetProfileHelper.StartOperation(this.ActiveDevice, new AsyncOperation.AOComplete(this.SetProfileDone), wirelessProfileToSave);
                this.WirelessHandleDeviceBusy(result);
            }
            if (result != WirelessStateResults.Success)
            {
                this.wirelessDeviceErrorDescription = wirelessProfileToSave == null?Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED_GENERIC) : string.Format(Shell.LoadString(StringId.IDS_WIRELESS_SYNC_SETUP_FAILED), wirelessProfileToSave.SSID);
            }
            return(result);
        }
Exemplo n.º 9
0
        private WirelessStateResults DoNextStep()
        {
            if (_iCurrentState == this._states.Length)
            {
                return(WirelessStateResults.Finished);
            }
            if (_iCurrentState > this._states.Length)
            {
                return(WirelessStateResults.Error);
            }
            if (this._fTryToCancel)
            {
                return(WirelessStateResults.Canceled);
            }
            WirelessStateResults result = this.DoStep(this._states[_iCurrentState]);

            if (result != WirelessStateResults.Success)
            {
                this.EndOperationInternal(result);
            }
            return(result);
        }
Exemplo n.º 10
0
 protected virtual void EndOperation(WirelessStateResults result)
 {
 }