示例#1
0
        private void _pullReqTargetsCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentHostedRemote = _pullReqTargetsCB.SelectedItem as IHostedRemote;

            _remoteBranchesCB.Items.Clear();
            _remoteBranchesCB.Text = _strLoading.Text;

            AsyncLoader.DoAsync(
                () => _currentHostedRemote.GetHostedRepository().Branches,
                branches =>
            {
                branches.Sort((a, b) => string.Compare(a.Name, b.Name, true));
                int selectItem = 0;
                _remoteBranchesCB.Items.Clear();
                for (int i = 0; i < branches.Count; i++)
                {
                    if (branches[i].Name == _currentBranch)
                    {
                        selectItem = i;
                    }

                    _remoteBranchesCB.Items.Add(branches[i].Name);
                }

                _createBtn.Enabled = true;
                if (branches.Count > 0)
                {
                    _remoteBranchesCB.SelectedIndex = selectItem;
                }
            },
                ex => { ex.Handled = false; });
        }
示例#2
0
        private void PopulateBranchesComboAndEnableCreateButton(IHostedRemote remote, ComboBox comboBox)
        {
            ThreadHelper.JoinableTaskFactory.RunAsync(
                async() =>
            {
                await TaskScheduler.Default;

                IHostedRepository hostedRepository = remote.GetHostedRepository();
                var branches = hostedRepository.GetBranches();

                await this.SwitchToMainThreadAsync();

                comboBox.Items.Clear();

                var selectItem    = 0;
                var defaultBranch = hostedRepository.GetDefaultBranch();
                for (var i = 0; i < branches.Count; i++)
                {
                    if (branches[i].Name == defaultBranch)
                    {
                        selectItem = i;
                    }

                    comboBox.Items.Add(branches[i].Name);
                }

                if (branches.Count > 0)
                {
                    comboBox.SelectedIndex = selectItem;
                }

                _createBtn.Enabled = true;
            })
            .FileAndForget();
        }
示例#3
0
        private void _pullReqTargetsCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentHostedRemote = _pullReqTargetsCB.SelectedItem as IHostedRemote;

            _remoteBranchesCB.Items.Clear();
            _remoteBranchesCB.Text = _strLoading.Text;

            PopulateBranchesComboAndEnableCreateButton(_currentHostedRemote, _remoteBranchesCB);
        }
        private void LoadRemotes(IHostedRemote[] foreignHostedRemotes)
        {
            _pullReqTargetsCB.Items.Clear();
            _pullReqTargetsCB.Items.AddRange(foreignHostedRemotes);

            if (_chooseRemote != null)
            {
                for (int i = 0; i < _pullReqTargetsCB.Items.Count; i++)
                {
                    var ihr = _pullReqTargetsCB.Items[i] as IHostedRemote;
                    if (ihr != null && ihr.Name == _chooseRemote)
                    {
                        _pullReqTargetsCB.SelectedIndex = i;
                        break;
                    }
                }
            }
            else if (_pullReqTargetsCB.Items.Count > 0)
                _pullReqTargetsCB.SelectedIndex = 0;

            _pullReqTargetsCB_SelectedIndexChanged(null, null);
        }
        private void _pullReqTargetsCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentHostedRemote = _pullReqTargetsCB.SelectedItem as IHostedRemote;

            _remoteBranchesCB.Items.Clear();
            _remoteBranchesCB.Text = _strLoading.Text;

            AsyncHelpers.DoAsync(
                () => _currentHostedRemote.GetHostedRepository().Branches,
                branches =>
            {
                foreach (var branch in branches)
                {
                    _remoteBranchesCB.Items.Add(branch.Name);
                }
                _createBtn.Enabled = true;
                if (branches.Count > 0)
                {
                    _remoteBranchesCB.SelectedIndex = 0;
                }
            },
                ex => { throw ex; });
        }
        private void _pullReqTargetsCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentHostedRemote = _pullReqTargetsCB.SelectedItem as IHostedRemote;

            _remoteBranchesCB.Items.Clear();
            _remoteBranchesCB.Text = _strLoading.Text;

            AsyncLoader.DoAsync(
                () => _currentHostedRemote.GetHostedRepository().Branches,
                branches =>
                {
                    branches.Sort((a, b) => String.Compare(a.Name, b.Name, true));
                    int selectItem = 0;
                    _remoteBranchesCB.Items.Clear();
                    for (int i = 0; i < branches.Count; i++)
                    {
                        if (branches[i].Name == _currentBranch)
                            selectItem = i;
                        _remoteBranchesCB.Items.Add(branches[i].Name);
                    }
                    _createBtn.Enabled = true;
                    if (branches.Count > 0)
                        _remoteBranchesCB.SelectedIndex = selectItem;
                },
                ex => { ex.Handled = false; });
        }
        private void _pullReqTargetsCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            _currentHostedRemote = _pullReqTargetsCB.SelectedItem as IHostedRemote;

            _remoteBranchesCB.Items.Clear();
            _remoteBranchesCB.Text = _strLoading.Text;

            AsyncHelpers.DoAsync(
                () => _currentHostedRemote.GetHostedRepository().Branches,
                (branches) =>
                {
                    foreach (var branch in branches)
                        _remoteBranchesCB.Items.Add(branch.Name);
                    _createBtn.Enabled = true;
                    if (branches.Count > 0)
                        _remoteBranchesCB.SelectedIndex = 0;
                },
                (ex) => { throw ex; });
        }