protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } _cameraPool.Dispose(); base.Dispose(disposing); }
private void Window_Closed(object sender, EventArgs e) { //TODO: Now that ship creation is async, this can run before ships are finished building. Disposing world //early causes bad things. See FlyingBeansWindow.Window_Closed for a hacked solution try { _world.Pause(); _updateManager.Dispose(); _selectionLogic.UnselectItem(); _selectionLogic = null; // Explosions //foreach (ExplodingBot explosion in _explosions.ToArray()) //{ // DisposeExplosion(explosion); //} _map.Dispose(); // this will dispose the physics bodies _map = null; if (_cameraPool != null) { _cameraPool.Dispose(); _cameraPool = null; } _world.Dispose(); _world = null; } catch (Exception ex) { MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void root_Closing(object sender, CancelEventArgs e) { StopLiveView(); _cameraPool.Dispose(); }