public void Dispose() { if (w.EnableRaisingEvents) { w.EnableRaisingEvents = false; w.Dispose(); w = null; } } }