Screen Refreshing Issue (Plugin Development) (1 Viewer)

elhefe

Portal Member
October 5, 2009
24
0
Home Country
Argentina Argentina
im lost in something so simple....


lets say a have a label and a button, and on the press of the button i need to do this:

Label.Label = "Text1"
System.Threading.Thread.Sleep(3000) <= or whatever function from an external dll I call, it's the same outcome
Label.Label = "Text2"
System.Threading.Thread.Sleep(3000)
Label.Label = "Text3"
System.Threading.Thread.Sleep(3000)
Label.Label = "Text3"

I thought I was going to see the label changing the text every 3 seconds, but it just hangs for 9 seconds and it then changes to Text3.

I tried different refreshes but I always have the same result? Anybody in the mood to help me out? I'd really appreciate it! And it frustrates me that not being able to do something so simple!!!!

Thanks in advance:D
 

Inker

Retired Team Member
  • Premium Supporter
  • December 6, 2004
    2,055
    318
    You are blocking the UI thread, so while you change your text in between your external calls, the renderer never gets a chance to render your changes.
     

    SilentException

    Retired Team Member
  • Premium Supporter
  • October 27, 2008
    2,617
    1,130
    Rijeka, Croatia
    Home Country
    Croatia Croatia
    As Inker said.. You need to call Process() before each sleep (which is bad practice) or do it from the separate thread (BackgroundWorker) - better :)
     

    elhefe

    Portal Member
    October 5, 2009
    24
    0
    Home Country
    Argentina Argentina
    thanks for the info guys!
    ill try calling a new thread that changes the text and sleeps and see if that works!
     

    Users who are viewing this thread

    Top Bottom