示例#1
0
 public TimeSpan FirstCommitToMergeTime()
 {
     if (!MergedAt.HasValue)
     {
         return(DateTime.Now.Subtract(Commits.First().Details.Committer.CommitDate));
     }
     else
     {
         return(MergedAt.Value.Subtract(Commits.First().Details.Committer.CommitDate));
     }
 }
示例#2
0
        private void LoadViewModel()
        {
            Timing t = new Timing();

            viewModelService.UpdateViewModel(this);

            UpdateViewModelImpl();

            if (Commits.Any())
            {
                SelectedIndex = 0;
                SelectedItem  = Commits.First();
            }

            t.Log("Updated repository view model");
        }
示例#3
0
        void ComputeCanvasBoundaries()
        {
            if (!Commits.Any())
            {
                CanvasBoundaries = new Tuple <double, double, double, double>(0, 0, 0, 0);
                return;
            }
            double i1, i2, i3, i4;

            i1 = i3 = Commits.First().Location.X;
            i2 = i4 = Commits.First().Location.Y;
            foreach (GraphItemModel m in Commits.Cast <GraphItemModel>().Union(Branches))
            {
                i1 = Math.Min(i1, m.Location.X);
                i2 = Math.Min(i2, m.Location.Y);
                i3 = Math.Max(i3, m.Location.X);
                i4 = Math.Max(i4, m.Location.Y);
            }
            CanvasBoundaries = new Tuple <double, double, double, double>(i1, i2, i3, i4);
        }
示例#4
0
        private void TrySetSelectedCommitPosition(
            CommitPosition commitPosition, bool ignoreTopIndex = false)
        {
            if (commitPosition != null)
            {
                if (!ignoreTopIndex && commitPosition.Index == 0)
                {
                    // The index was 0 (top) lest ensure the index remains 0 again
                    Log.Debug("Scroll to 0 since first position was 0");
                    ScrollTo(0);
                    if (Commits.Any())
                    {
                        SelectedIndex = 0;
                        SelectedItem  = Commits.First();
                    }

                    return;
                }

                Commit selected = commitPosition.Commit;

                int indexAfter = Commits.FindIndex(c => c.Commit.Id == selected.Id);

                if (selected != null && indexAfter != -1)
                {
                    int indexBefore = commitPosition.Index;
                    ScrollRows(indexBefore - indexAfter);
                    SelectedIndex = indexAfter;
                    SelectedItem  = Commits[indexAfter];
                    return;
                }
            }

            ScrollTo(0);
            if (Commits.Any())
            {
                SelectedIndex = 0;
                SelectedItem  = Commits.First();
            }
        }