public void Dispose() { tokenSource?.Dispose(); dataToSave?.Dispose(); Start?.Dispose(); Stop?.Dispose(); OpenSettings?.Dispose(); }
public async Task StartAndAwaitReconnectionAsync(CancellationToken cancel) { Stop?.Dispose(); Stop = CancellationTokenSource.CreateLinkedTokenSource(cancel); ForeverTask = ForeverMethodAsync(x => x is true); await ForeverTask.ConfigureAwait(false); await StopAsync().ConfigureAwait(false); }
public async Task DisposeAsync() { Stop?.Cancel(); await ReconnectorTask.ConfigureAwait(false); Disconnect(); Stop?.Dispose(); Stop = null; }
public async Task StopAsync() { Interlocked.CompareExchange(ref _running, 2, 1); // If running, make it stopping. Stop?.Cancel(); while (IsStopping) { await Task.Delay(50); } Stop?.Dispose(); }
public async Task StopAsync() { if (IsRunning) { Interlocked.Exchange(ref _running, 2); } Stop?.Cancel(); while (IsStopping) { await Task.Delay(50); } Stop?.Dispose(); }
protected override void Dispose(bool disposing) { if (disposing) { _isPlaying.Dispose(); _isPaused.Dispose(); _isStopped.Dispose(); _state.Dispose(); Play.Dispose(); Pause.Dispose(); Stop.Dispose(); } base.Dispose(disposing); }
private volatile bool _disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { Stop?.Cancel(); Disconnect(); Stop?.Dispose(); Stop = null; } _disposedValue = true; } }
public async Task DisposeAsync() { if (_disposed) { return; } _disposed = true; Stop.Cancel(); await P2pReconnector.StopAsync(CancellationToken.None).ConfigureAwait(false); P2pReconnector.Dispose(); await TryDisconnectAsync(CancellationToken.None).ConfigureAwait(false); Stop.Dispose(); }
private volatile bool _disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { Interlocked.CompareExchange(ref _running, 2, 1); // If running, make it stopping. Stop?.Cancel(); while (IsStopping) { Task.Delay(50).GetAwaiter().GetResult(); } Stop?.Dispose(); } _disposedValue = true; } }
void ReleaseDesignerOutlets() { if (ArduinoPortsMenu != null) { ArduinoPortsMenu.Dispose(); ArduinoPortsMenu = null; } if (Exit != null) { Exit.Dispose(); Exit = null; } if (FiftyMinutes != null) { FiftyMinutes.Dispose(); FiftyMinutes = null; } if (FortyMinutes != null) { FortyMinutes.Dispose(); FortyMinutes = null; } if (SixtyMinutes != null) { SixtyMinutes.Dispose(); SixtyMinutes = null; } if (StatusMenu != null) { StatusMenu.Dispose(); StatusMenu = null; } if (Stop != null) { Stop.Dispose(); Stop = null; } if (TenMinutes != null) { TenMinutes.Dispose(); TenMinutes = null; } if (ThirtyMinutes != null) { ThirtyMinutes.Dispose(); ThirtyMinutes = null; } if (TwentyMinutes != null) { TwentyMinutes.Dispose(); TwentyMinutes = null; } if (Test != null) { Test.Dispose(); Test = null; } }