Example #1
0
        async private Task <T> call <T>(Func <Task <T> > func, string cancelMessage, string errorMessage)
        {
            if (_operator == null)
            {
                _operator = new RepositoryOperator(_projectKey, _settings, _networkOperationStatusListener);
            }

            try
            {
                return(await func());
            }
            catch (OperatorException ex)
            {
                if (ex.Cancelled)
                {
                    Trace.TraceInformation(String.Format("[RepositoryAccessor] {0}", cancelMessage));
                    return(default(T));
                }
                throw new RepositoryAccessorException(errorMessage, ex);
            }
        }
        async private Task call(Func <Task> func, string cancelMessage, string errorMessage)
        {
            if (_operator == null)
            {
                _operator = new RepositoryOperator(_projectKey, _settings);
            }

            try
            {
                await func();
            }
            catch (OperatorException ex)
            {
                if (ex.Cancelled)
                {
                    Trace.TraceInformation(String.Format("[RepositoryAccessor] {0}", cancelMessage));
                    return;
                }
                throw new RepositoryAccessorException(errorMessage, ex);
            }
        }