protected override async Task OnBranchSelection(string command) { var branch = CurrentRepository.GetBranchInfo(includeRemote: false) .FirstOrDefault(x => string.Equals(x.Name, command, StringComparison.OrdinalIgnoreCase)); var switchInfo = new SwitchBranchInfo() { BranchInfo = branch, Switch = true, Repository = CurrentRepository }; await GitCommandWrappers.SwitchCommand(switchInfo); }
internal async Task SwitchCommand(SwitchBranchInfo branchInfo) { var switchResult = await GitCommandWrappers.SwitchCommand(branchInfo); if (switchResult.Succeeded) { await UpdateRepositoryName(); } else { MessageBox.Show(switchResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
internal SwitchBranchInfo 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 SwitchBranchInfo(); _pickerResult.Repository = repository; if (window.ShowDialog() == true) { return(_pickerResult); } else { return(new SwitchBranchInfo()); } }
internal async Task OnSwitchCommand(SwitchBranchInfo result) { await control.SwitchCommand(result); }