Hallo,
Mein Programm muss eine wav datei öffnen und die Samples komplett einlesen. Nun dauert das ein bisschen und ich möchte den user ja nicht im dunkeln stehen lassen, also musste ein Dialog her, der sagt, was grad so abläuft.
Nun habe ich einen selsamen Effekt:
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
| public void TryReadData(uint channel) { lbInfo.Text = "Reading data into memory. Please wait."; try{ fileToOpen.ReadData(channel); }catch(Exception ex) { lbInfo.Text = "Failed to read data: " + ex.Message; return; } } |
Nämlich beim Aufruf wird ZUERST ReadData() aufgerufen, und dann erst der Text in den Label geschrieben (was dann allerdings schon zu spät ist) . Eigentlich soll ja erst dastehen "Reading ... " und dann das laden losgehen, aber es ist genau andersrum. Ich kann mir dieses Verhalten einfach nicht erklären. Mit Invalidate() oder ähnlichem habe ich schon versucht, ein Repaint the labels zu erzwingen, ohne Wirkung.
Das gleiche Problem hier: Zurerst wird TryToRead() aufgerufen, erst danach wird die Checkbox Disabled
C#-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
| void CbChannelSelectedIndexChanged(object sender, System.EventArgs e) { cbChannel.Enabled = false; if(cbChannel.SelectedIndex == 0) { TryReadData(1); } else { TryReadData(2); } } |