Resume() public method

public Resume ( ) : void
return void
Esempio n. 1
0
 public async void Play()
 {
     try
     {
         if (!_isStarted)
         {
             _cancellationTokenSource = new CancellationTokenSource();
             _isStarted = true;
             if (_timingManager.IsPaused)
                 _timingManager.Resume();
             await RunAsync(_cancellationTokenSource.Token);
         }
         else if (_timingManager.IsPaused)
         {
             _timingManager.Resume();
         }
     }
     catch (OperationCanceledException)
     {
     }
     catch (Exception ex)
     {
         // ignore errors that might occur during Dispose
         if (!_disposing)
             AnimationBehavior.OnError(_image, ex, AnimationErrorKind.Rendering);
     }
 }
Esempio n. 2
0
        public async void Play()
        {
            try
            {
                if (_timingManager.IsComplete)
                {
                    _timingManager.Reset();
                    _isStarted = false;
                }

                if (!_isStarted)
                {
                    _cancellationTokenSource?.Dispose();
                    _cancellationTokenSource = new CancellationTokenSource();
                    _isStarted = true;
                    OnAnimationStarted();
                    if (_timingManager.IsPaused)
                    {
                        _timingManager.Resume();
                    }
                    await RunAsync(_cancellationTokenSource.Token);
                }
                else if (_timingManager.IsPaused)
                {
                    _timingManager.Resume();
                }
            }
            catch (OperationCanceledException)
            {
            }
            catch (Exception ex)
            {
                // ignore errors that might occur during Dispose
                if (!_disposing)
                {
                    OnError(ex, AnimationErrorKind.Rendering);
                }
            }
        }