Exemple #1
0
        private void InitialiseTabDefaultPullBehaviors(string preselectLocal = null)
        {
            var heads = Module.GetRefs(false, true);

            RemoteRepositoryCombo.Sorted        = false;
            RemoteRepositoryCombo.DataSource    = new[] { new GitRemote() }.Union(UserGitRemotes).ToList();
            RemoteRepositoryCombo.DisplayMember = nameof(GitRemote.Name);

            RemoteBranches.AutoGenerateColumns = false;
            RemoteBranches.SelectionChanged   -= RemoteBranchesSelectionChanged;
            RemoteBranches.DataError          += RemoteBranchesDataError;
            RemoteBranches.DataSource          = heads;
            RemoteBranches.ClearSelection();
            RemoteBranches.SelectionChanged += RemoteBranchesSelectionChanged;
            var preselectLocalRow = RemoteBranches.Rows.Cast <DataGridViewRow>().
                                    FirstOrDefault(r => r.DataBoundItem is IGitRef gitRef ? gitRef.LocalName == preselectLocal : false);

            if (preselectLocalRow != null)
            {
                preselectLocalRow.Selected = true;
            }
            else if (RemoteBranches.Rows.Count > 0)
            {
                RemoteBranches.Rows[0].Selected = true;
            }
        }
Exemple #2
0
        private void InitialiseTabBehaviors()
        {
            var heads = Module.GetRefs(false, true);

            RemoteRepositoryCombo.Sorted        = false;
            RemoteRepositoryCombo.DataSource    = new[] { new GitRemote() }.Union(_gitRemoteController.Remotes).ToList();
            RemoteRepositoryCombo.DisplayMember = "Name";

            RemoteBranches.AutoGenerateColumns = false;
            RemoteBranches.SelectionChanged   -= RemoteBranchesSelectionChanged;
            RemoteBranches.DataError          += RemoteBranchesDataError;
            RemoteBranches.DataSource          = heads;
            RemoteBranches.ClearSelection();
            RemoteBranches.SelectionChanged += RemoteBranchesSelectionChanged;

            if (RemoteBranches.Rows.Count > 0)
            {
                RemoteBranches.Rows[0].Selected = true;
            }
        }