Exemplo n.º 1
0
 public void Dispose()
 {
     tokenSource?.Dispose();
     dataToSave?.Dispose();
     Start?.Dispose();
     Stop?.Dispose();
     OpenSettings?.Dispose();
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public async Task DisposeAsync()
        {
            Stop?.Cancel();
            await ReconnectorTask.ConfigureAwait(false);

            Disconnect();
            Stop?.Dispose();
            Stop = null;
        }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 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);
 }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
    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();
    }
Exemplo n.º 9
0
        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;
            }
        }