public override void OnDisable() { _timer.Change(Timeout.Infinite, Timeout.Infinite); _biomeMapForm.Hide(); _biomeMapForm = null; base.OnDisable(); }
private void CreateForm(Level level) { _biomeMapForm?.Hide(); _biomeMapForm = new BiomeMapForm(level); _biomeMapForm.FormClosing += (sender, args) => { _timer?.Change(Timeout.Infinite, Timeout.Infinite); _biomeMapForm = null; }; _biomeMapForm.Shown += (sender, args) => { _timer = new Timer(Update, null, 1000, 1000); }; ThreadPool.QueueUserWorkItem(delegate { Application.Run(_biomeMapForm); }); }