protected override void OnClosing(CancelEventArgs e) { // Остановить регистрацию _peerNameRegistration.Stop(); _peerNameRegistration.Dispose(); // Остановить WCF-сервис if (_host.State == CommunicationState.Opened) { _host.Close(); } base.OnClosing(e); }
protected override void OnClosing(CancelEventArgs e) { // Stop registration peerNameRegistration.Stop(); peerNameRegistration.Dispose(); // Stop WCF service if (host.State == CommunicationState.Opened) { host.Close(); } base.OnClosing(e); }
protected virtual void Dispose(bool disposing) { // If you need thread safety, use a lock around these // operations, as well as in your methods that use the resource. if (Disposed) { return; } if (disposing) { _peerRegist.Dispose(); } // Indicate that the instance has been disposed. Disposed = true; _peerRegist = null; _peerResolver = null; }