Пример #1
0
        public static void AttachListener(this IRepositoryWatcherListener listener, IRepositoryWatcher repositoryWatcher, RepositoryWatcherAutoResetEvent autoResetEvent = null, bool trace = false)
        {
            var logger = trace ? LogHelper.GetLogger <IRepositoryWatcherListener>() : null;

            repositoryWatcher.HeadChanged += () =>
            {
                logger?.Trace("HeadChanged");
                listener.HeadChanged();
                autoResetEvent?.HeadChanged.Set();
            };

            repositoryWatcher.IndexChanged += () =>
            {
                logger?.Trace("IndexChanged");
                listener.IndexChanged();
                autoResetEvent?.IndexChanged.Set();
            };

            repositoryWatcher.ConfigChanged += () =>
            {
                logger?.Trace("ConfigChanged");
                listener.ConfigChanged();
                autoResetEvent?.ConfigChanged.Set();
            };

            repositoryWatcher.RepositoryCommitted += () =>
            {
                logger?.Trace("ConfigChanged");
                listener.RepositoryCommitted();
                autoResetEvent?.RepositoryCommitted.Set();
            };

            repositoryWatcher.RepositoryChanged += () =>
            {
                logger?.Trace("RepositoryChanged");
                listener.RepositoryChanged();
                autoResetEvent?.RepositoryChanged.Set();
            };

            repositoryWatcher.LocalBranchesChanged += () =>
            {
                logger?.Trace("LocalBranchesChanged");
                listener.LocalBranchesChanged();
                autoResetEvent?.LocalBranchesChanged.Set();
            };

            repositoryWatcher.RemoteBranchesChanged += () =>
            {
                logger?.Trace("RemoteBranchesChanged");
                listener.RemoteBranchesChanged();
                autoResetEvent?.RemoteBranchesChanged.Set();
            };
        }
Пример #2
0
        public static void AttachListener(this IRepositoryWatcherListener listener, IRepositoryWatcher repositoryWatcher, RepositoryWatcherAutoResetEvent autoResetEvent = null, bool trace = false)
        {
            var logger = trace ? Logging.GetLogger <IRepositoryWatcherListener>() : null;

            repositoryWatcher.HeadChanged += () =>
            {
                logger?.Trace("HeadChanged");
                listener.HeadChanged();
                autoResetEvent?.HeadChanged.Set();
            };

            repositoryWatcher.ConfigChanged += () =>
            {
                logger?.Trace("ConfigChanged");
                listener.ConfigChanged();
                autoResetEvent?.ConfigChanged.Set();
            };

            repositoryWatcher.IndexChanged += () =>
            {
                logger?.Trace("IndexChanged");
                listener.IndexChanged();
                autoResetEvent?.IndexChanged.Set();
            };

            repositoryWatcher.LocalBranchChanged += s =>
            {
                logger?.Trace("LocalBranchChanged: {0}", s);
                listener.LocalBranchChanged(s);
                autoResetEvent?.LocalBranchChanged.Set();
            };

            repositoryWatcher.LocalBranchCreated += s =>
            {
                logger?.Trace("LocalBranchCreated: {0}", s);
                listener.LocalBranchCreated(s);
                autoResetEvent?.LocalBranchCreated.Set();
            };

            repositoryWatcher.LocalBranchDeleted += s =>
            {
                logger?.Trace("LocalBranchDeleted: {0}", s);
                listener.LocalBranchDeleted(s);
                autoResetEvent?.LocalBranchDeleted.Set();
            };

            repositoryWatcher.RemoteBranchCreated += (s, s1) =>
            {
                logger?.Trace("RemoteBranchCreated: {0} {1}", s, s1);
                listener.RemoteBranchCreated(s, s1);
                autoResetEvent?.RemoteBranchCreated.Set();
            };

            repositoryWatcher.RemoteBranchDeleted += (s, s1) =>
            {
                logger?.Trace("RemoteBranchDeleted: {0} {1}", s, s1);
                listener.RemoteBranchDeleted(s, s1);
                autoResetEvent?.RemoteBranchDeleted.Set();
            };

            repositoryWatcher.RepositoryChanged += () =>
            {
                logger?.Trace("RepositoryChanged");
                listener.RepositoryChanged();
                autoResetEvent?.RepositoryChanged.Set();
            };
        }