Esempio n. 1
0
 public static void AttachListener(this IRepositoryListener listener,
                                   IRepository repository, RepositoryEvents repositoryEvents = null, bool trace = true)
 {
     //var logger = trace ? Logging.GetLogger<IRepositoryListener>() : null;
 }
Esempio n. 2
0
        public static void AttachListener(this IRepositoryListener listener,
                                          IRepository repository, RepositoryEvents repositoryEvents = null, bool trace = true)
        {
            var logger = trace ? Logging.GetLogger <IRepositoryListener>() : null;

            repository.OnStatusChanged += gitStatus =>
            {
                logger?.Trace("OnStatusChanged: {0}", gitStatus);
                listener.OnStatusChanged(gitStatus);
                repositoryEvents?.OnStatusChanged.Set();
            };

            repository.OnCurrentBranchChanged += name =>
            {
                logger?.Debug("OnCurrentBranchChanged: {0}", name);
                listener.OnCurrentBranchChanged(name);
                repositoryEvents?.OnCurrentBranchChanged.Set();
            };

            repository.OnCurrentRemoteChanged += name =>
            {
                logger?.Debug("OnCurrentRemoteChanged: {0}", name);
                listener.OnCurrentRemoteChanged(name);
                repositoryEvents?.OnCurrentRemoteChanged.Set();
            };

            repository.OnLocalBranchListChanged += () =>
            {
                logger?.Debug("OnLocalBranchListChanged");
                listener.OnLocalBranchListChanged();
                repositoryEvents?.OnLocalBranchListChanged.Set();
            };

            repository.OnRemoteBranchListChanged += () =>
            {
                logger?.Debug("OnRemoteBranchListChanged");
                listener.OnRemoteBranchListChanged();
                repositoryEvents?.OnRemoteBranchListChanged.Set();
            };

            repository.OnCurrentBranchUpdated += () =>
            {
                logger?.Debug("OnHeadChanged");
                listener.OnHeadChanged();
                repositoryEvents?.OnHeadChanged.Set();
            };

            repository.OnLocksChanged += locks =>
            {
                logger?.Debug("OnLocksChanged: {0}", locks);
                listener.OnLocksChanged(locks);
                repositoryEvents?.OnLocksChanged.Set();
            };

            repository.OnRepositoryInfoChanged += () =>
            {
                logger?.Debug("OnRepositoryInfoChanged");
                listener.OnRepositoryInfoChanged();
                repositoryEvents?.OnRepositoryInfoChanged.Set();
            };
        }