Exemplo n.º 1
0
        protected sealed override async Task start()
        {
            if (_current == null)
            {
                _disposable = Disposable.GetValue();

                _current = Activity;
            }

            try
            {
                var task = _current.Start();

                Status = _current.Status;

                await task;

                Status = _current.Status;

                if (_current.Status == ActivityStatus.Suspended)
                {
                    return;
                }
            }
            catch
            {
                if (_disposable != null)
                {
                    _disposable.Dispose();
                    _disposable = null;
                }

                throw;
            }

            if (_disposable != null)
            {
                _disposable.Dispose();
                _disposable = null;
            }
        }