void Form_Resize(object sender, EventArgs e) { if (MainForm.WindowState == FormWindowState.Minimized) { WasPlaying = !Core.GetPropertyBool("pause"); if (WasPlaying) { Core.SetPropertyBool("pause", true, true); WasPaused = true; } } else { if (WasPaused) { Core.SetPropertyBool("pause", false, true); WasPaused = false; } } }