lable1.Text = "hai";
doesn't get executed immediately. Like all GUI operations, it gets queued inernally until the next UI redraw. But the UI thread is blocked by
thread.Sleep(3000);
.
So you need to execute the sleep part in a worker thread. Something like
private void DelayedMethod()
{
System.Threading.Thread.Sleep(3000);
SetTheme("Whatever");
}
void YourCurrentMethodOnUiThread()
{
label1.Text = "hai";
System.Threading.Thread otherThread = new System.Threading.Thread(DelayedMethod);
otherThread.Start();
}