Пример #1
0
        void Args_Log(object sender, GitLogEventArgs e)
        {
            if (IsDisposed)
            {
                e.Cancel = true;
                return;
            }

            GitHead[] heads;

            if (e.Refs == null)
                heads = EmptyHeads;
            else
                heads = e.Refs.Where(p => p.Name != GitConstants.Head).Select(p => new GitHead(p.Revision, p.Name)).ToArray();

            UpdateGraph(new GitRevision
            {
                Author = e.AuthorName,
                AuthorDate = e.AuthorTime,
                AuthorEmail = e.AuthorEmail,
                CommitDate = e.Time,
                Revision = e.Revision,
                LogMessage = e.LogMessage,
                ParentRevisions = e.ParentRevisions,
                Heads = heads,
                Index = _revisionsLoaded++,
                RepositoryRoot = RepositoryPath
            });

            // Force an early refresh to get some content into the grid.

            if (_revisionsLoaded == 100)
            {
                BeginInvoke(new Action<bool>(UpdateContents), false);

                _revisionLoadStart = new Stopwatch();
                _revisionLoadStart.Start();
            }

            // Force a refresh every three seconds, incremented by one second
            // on every refresh.

            if (_revisionLoadStart != null)
            {
                if (_revisionLoadStart.Elapsed > _revisionNextUpdate)
                {
                    _revisionLoadStart.Restart();

                    _revisionNextUpdate += TimeSpan.FromSeconds(1);

                    BeginInvoke(new Action<bool>(UpdateContents), false);
                }
            }
        }
Пример #2
0
        internal void OnLog(GitLogEventArgs e)
        {
            var ev = Log;

            if (ev != null)
                ev(this, e);
        }