private void LoadBranchesAsync()
        {
            var selectedBranch = UICommands.GitModule.GetSelectedBranch();

            ExistingBranches      = Module.GetRefs(false);
            comboBoxBranches.Text = Strings.GetLoadingData();
            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                await _branchesLoader.LoadAsync(
                    () => ExistingBranches.Where(r => r.Name != selectedBranch).ToList(),
                    list =>
                {
                    comboBoxBranches.Text          = string.Empty;
                    comboBoxBranches.DataSource    = list;
                    comboBoxBranches.DisplayMember = "LocalName";
                });

                await this.SwitchToMainThreadAsync();
                if (comboBoxBranches.Items.Count == 0)
                {
                    radioButtonCreateNewBranch.Checked        = true;
                    radioButtonCheckoutExistingBranch.Enabled = false;
                }
                else
                {
                    radioButtonCheckoutExistingBranch.Checked = true;
                }

                ValidateWorktreeOptions();
            });
        }
Beispiel #2
0
        private void LoadBranchesAsync()
        {
            var selectedBranch = UICommands.GitModule.GetSelectedBranch();

            ExistingBranches      = Module.GetRefs(false);
            comboBoxBranches.Text = Strings.GetLoadingData();
            _branchesLoader.Load(
                () => ExistingBranches.Where(r => r.Name != selectedBranch).ToList(),
                list =>
            {
                comboBoxBranches.Text          = string.Empty;
                comboBoxBranches.DataSource    = list;
                comboBoxBranches.DisplayMember = "LocalName";
            })
            .ContinueWith(_ =>
            {
                if (comboBoxBranches.Items.Count == 0)
                {
                    radioButtonCreateNewBranch.Checked        = true;
                    radioButtonCheckoutExistingBranch.Enabled = false;
                }
                else
                {
                    radioButtonCheckoutExistingBranch.Checked = true;
                }

                ValidateWorktreeOptions();
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }