c# - Thread.Sleep or Timer for showing every step -
i making game wumpus world in winforms in agent(computer) can move in 4 directions. using button control base , showing , hiding images ever needed. used thread.sleep problem when click button nothing showing on form. process on background working fine not showing each step. , yes using thread.sleep
in current ui
thread.
i want show every step users interval of 2 seconds.
it's hard answer without code go by, main problem understand change of world, , tell sleep, witch means nothing painted. , when thread wakes up, again change world , make sleep. nothing painted way.
better way timer, make single timer , queue of events needed shown , on way it.
are working on winforms, because if working on wpf can nicer things
edit: i'm not saying timer best way it, it's valid way
Comments
Post a Comment