コード例 #1
0
        public void RequestUpdate(ICommitStorageUpdateContextProvider contextProvider, Action onFinished)
        {
            _synchronizeInvoke.BeginInvoke(new Action(
                                               async() =>
            {
                if (_gitRepository.ExpectingClone)
                {
                    traceInformation("RequestUpdate() does nothing because repository is not cloned");
                    return;
                }

                try
                {
                    traceInformation(String.Format("RequestUpdate() called with context of type {0}",
                                                   contextProvider?.GetContext()?.GetType().ToString() ?? "null"));

                    await doUpdate(false, contextProvider?.GetContext(), null, null);
                    onFinished?.Invoke();
                }
                catch (GitCommandException ex)
                {
                    ExceptionHandlers.Handle("Silent update failed", ex);
                }
                finally
                {
                    traceInformation("RequestUpdate() finished");
                }
            }), null);
        }
コード例 #2
0
        async public Task StartUpdate(ICommitStorageUpdateContextProvider contextProvider,
                                      Action <string> onProgressChange, Action onUpdateStateChange)
        {
            if (onProgressChange == null || onUpdateStateChange == null)
            {
                throw new NotImplementedException(); // not tested cases
            }

            try
            {
                ++_activeAwaitedUpdateRequestCount;
                traceInformation(String.Format("StartUpdate() called with context of type {0}",
                                               contextProvider?.GetContext()?.GetType().ToString() ?? "null"));
                await doUpdate(true, contextProvider?.GetContext(), onProgressChange);
            }
            catch (RepositoryAccessorException ex)
            {
                throw new LocalCommitStorageUpdaterFailedException("Cannot update file storage", ex);
            }
            finally
            {
                --_activeAwaitedUpdateRequestCount;
                reportProgress(onProgressChange, String.Empty);
                traceInformation("StartUpdate() finished");
            }
        }
コード例 #3
0
        async public Task StartUpdate(ICommitStorageUpdateContextProvider contextProvider,
                                      Action <string> onProgressChange, Action onUpdateStateChange)
        {
            if (onProgressChange == null || onUpdateStateChange == null)
            {
                throw new NotImplementedException(); // not tested cases
            }

            try
            {
                traceInformation(String.Format("StartUpdate() called with context of type {0}",
                                               contextProvider?.GetContext()?.GetType().ToString() ?? "null"));
                registerCallbacks(onProgressChange, onUpdateStateChange);
                await doUpdate(true, contextProvider?.GetContext(), onProgressChange, onUpdateStateChange);
            }
            catch (GitCommandException ex)
            {
                handleException(ex);
            }
            finally
            {
                unregisterCallbacks(onProgressChange, onUpdateStateChange);
                reportProgress(onProgressChange, String.Empty);
                traceInformation("StartUpdate() finished");
            }
        }
コード例 #4
0
        public void RequestUpdate(ICommitStorageUpdateContextProvider contextProvider, Action onFinished)
        {
            _synchronizeInvoke.BeginInvoke(new Action(
                                               async() =>
            {
                try
                {
                    traceInformation(String.Format("RequestUpdate() called with context of type {0}",
                                                   contextProvider?.GetContext()?.GetType().ToString() ?? "null"));

                    await doUpdate(false, contextProvider?.GetContext(), null);
                    onFinished?.Invoke();
                }
                catch (RepositoryAccessorException ex)
                {
                    ExceptionHandlers.Handle("Silent update failed", ex);
                }
                catch (LocalCommitStorageUpdaterLimitException ex)
                {
                    ExceptionHandlers.Handle("Silent update failed", ex);
                }
                finally
                {
                    traceInformation("RequestUpdate() finished");
                }
            }), null);
        }