private void SwitchButtonsState() { if (Button1.IsEnabled) { Button1.IsEnabled = false; Button2.IsEnabled = false; Button3.IsEnabled = false; Button4.IsEnabled = false; } else { Button1.IsEnabled = true; Button2.IsEnabled = true; Button3.IsEnabled = true; Button4.IsEnabled = true; } Button1.Refresh(); Button2.Refresh(); Button3.Refresh(); Button4.Refresh(); }