Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Moin,

 

in den Beispielen werden die Werte auf der Console ausgegeben.

Ich möchte den gemessenen Luftdruck gern in einer ListBox (GUI) speichern, anzeigen und später auswerten.

 

Vermutlich habe ich das Threading nicht richtig verstanden.

 

In ExampleCallback.vb ist folgender Handler gesetzt:

AddHandler b.AirPressure, AddressOf AirPressureCB

 

Die CallBack-Prozedur

Sub AirPressureCB ... Console.WriteLine("Air Pressure: " + (airPressure / 1000.0).ToString() + " mbar")

schreibt fleißig alle Werte auf die Console.

 

Versuche ich in der Callback-Prozedur

AirPressureCB

den Wert auf die ListBox zu übertragen, dann bekomme ich einen Fehler

LB_AirPressureList.Items.Add(airPressure)

 

OK, das geht nur, wenn ich die Threads mit einem

BackgroundWorker

trenne.

 

Die Übergabe eines einzelnen Wertes in die ListBox mittels

BackgroundWorker.ReportProgress(b.GetAirPressure / 1000.0)

funktioniert.

 

Nun meine Frage:

Wie kombiniere ich die Handler-Prozedur

AirPressureCB

mit dem

Backgroundworker

so, dass sämtliche Werte in die Listbox übergeben werden?

 

Ich hoffe, dass das schon mal jemand gemacht.

 

Hilfe.

 

Viele Grüße

Thomas

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.