/// <summary> /// Releases the unmanaged resources that are used by the object and, optionally, releases the managed resources. /// </summary> /// <param name="disposing"> /// true to release both managed and unmanaged resources; false to release only unmanaged /// resources. /// </param> protected override void Dispose(bool disposing) { if (disposing) { _serviceProxy?.Dispose(); } base.Dispose(disposing); }
/// <summary> /// The window is about to close. Disposes the service proxies. /// </summary> /// <param name="e"></param> protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { try { ServiceProxy.Dispose(); } catch (Exception exc) { Console.WriteLine("Exception in OnClosing: " + exc.Message); } base.OnClosing(e); }
private void Dispose(bool disposing) { // check to see if Dispose has already been called. if (!_disposed) { if (disposing) { if (_proxy != null) { _proxy.Dispose(); //_proxy = null; } } _disposed = true; } }