Example #1
0
        internal BranchPickerResult Show()
        {
            window = new Window
            {
                Title   = "Switch (checkout) branch",
                Content = this,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                ResizeMode            = System.Windows.ResizeMode.NoResize,
                Width  = 350,
                Height = 200
            };
            _branches.Clear();
            var branches = repository.GetBranchInfo(forceReload: true);

            branches = branches.OrderBy(x => x.IsRemote).ThenBy(x => x.FullName).ToList();//.Select(r => r.FullName); ;
            foreach (var gitBranchInfo in branches)
            {
                _branches.Add(gitBranchInfo);
            }
            comboBranches.ItemsSource = branches;
            comboBranches.Items.Refresh();
            comboBranches.DisplayMemberPath = "FullName";
            comboBranches.SelectedValuePath = "CanonicalName";
            comboBranches.SelectedValue     = repository.CurrentBranchInfo.CanonicalName;
            _pickerResult            = new BranchPickerResult();
            _pickerResult.Repository = repository;


            if (window.ShowDialog() == true)
            {
                return(_pickerResult);
            }
            else
            {
                return(new BranchPickerResult());
            }
        }
        internal BranchPickerResult Show()
        {
            window = new Window
            {
                Title = "Switch (checkout) branch",
                Content = this,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                ResizeMode = System.Windows.ResizeMode.NoResize,
                Width = 350,
                Height = 200
            };
            _branches.Clear();
            var branches = repository.GetBranchInfo(forceReload:true);
            branches = branches.OrderBy(x => x.IsRemote).ThenBy(x => x.FullName).ToList();//.Select(r => r.FullName); ;
            foreach (var gitBranchInfo in branches)
            {
                _branches.Add(gitBranchInfo);
            }
            comboBranches.ItemsSource = branches;
            comboBranches.Items.Refresh();
            comboBranches.DisplayMemberPath = "FullName";
            comboBranches.SelectedValuePath = "CanonicalName";
            comboBranches.SelectedValue = repository.CurrentBranchInfo.CanonicalName;
            _pickerResult = new BranchPickerResult();
            _pickerResult.Repository = repository;


            if (window.ShowDialog() == true)
            {
                return _pickerResult;
            }
            else
            {
                return new BranchPickerResult();
            }
        }