About new "NWPathMonitor Test" MBS example

Hello,

In the “/MacOSX/NWPathMonitor Test” example which uses the new NWPathMonitor class, i want to make a function which returns whether a network connection (Internet) is detected or not but I cannot see what the “value” parameter corresponds to (Dim path As NWPathMBS = value), which seems closely linked to the listbox, to replace it with a value passed as a function parameter. If anyone can enlighten me…

List.ExpandRow
Dim value As Variant = Me.RowTagAt(row)
AddValue value
Dim path As NWPathMBS = value
Dim StatusText As String
Select Case path.Status
Case path.kStatusSatisfiable
  StatusText = "Satisfiable" 
Case path.kStatusUnsatisfied
  StatusText = "Unsatisfied"
Case path.kStatusSatisfied
  StatusText = "Satisfied" 
Case path.kStatusInvalid
  StatusText = "Invalid" 
End Select

List.AddRow "Status", path.Status.ToString+" "+StatusText

Moreover, in this example, how to replace the obsolete “List.AddFolder” (in the AddValue method) and which accepts two parameters, one of which is a class (NWInterfaceMBS), with List.AddExpandableRow() which takes a single text value and generates an error on the class?

Thanks.

This is a bit of work since this comes asynchronously.

You’d subclass the NWPathMonitorMBS Class, add a property for current path and then set it in the update event. I may also add that for a future version of the class.

So on start of app, you can call start method on an instance of your subclass and keep a reference in a property in the app or a module.

Then later at any time you can refer to this object and check the current path property.

Not easy!
“I may also add that for a future version of the class.”
I’m willing… we’ll wait!
Thanks.

with Christian, the updates can be really really fast !