locked
Problems getting a SystemState RRS feed

  • Question

  • I was trying to use a SystemState in order to query the SystemProperty.WiFiStateConnected in a mobile VB program:

     

        Private Wifi As SystemState
    

     

    with OnLoad for the form:

     

            Wifi = New SystemState(SystemProperty.WiFiStateConnected)
            AddHandler Wifi.Changed, AddressOf WifiChanged
            txtNetwork.Text = "Wifi: " & Wifi.CurrentValue.ToString()
    

     

    WifiChanged:

     

        Private Sub WifiChanged(ByVal sender As Object, ByVal e As ChangeEventArgs)
            Dim connected As Integer = e.NewValue
            txtNetwork.Text = "Wifi: " & connected.ToString()
        End Sub
    

     


    I have two problems.

    1. WifiChanged never appears to be raised even though I let the unit go to sleep and wake it up again.

    2. I haven't been able to grad the value manually either. Both of these will return a NullReferenceException:

     

    SystemState.GetValue(SystemProperty.WiFiStateConnected).ToString()
    
    Wifi.CurrentValue.ToString()
    

     

    Wifi.CurrentValue gives this message in debug:

    A first chance exception of type 'Microsoft.WindowsMobile.Utilities.Registry.RegistryException' occurred in Microsoft.WindowsMobile.Utilities.dll
    Method call did not return a value.

    So how do I successfully query WiFiStateConnected?

    Monday, January 9, 2012 8:34 PM

Answers

  • Hello,

     

    Did you test your application on emulator? The code is fine, so I think there should be some issues in your SDK or your device. Did your application run on Windows CE ROM made by other manufactory, if so you can ask help from that manufactory.

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Aaron Hartley Thursday, January 12, 2012 6:23 PM
    Wednesday, January 11, 2012 11:49 AM