private void SetGitAction(GitAction action, bool hasConflicts) { if ((action == _action) && (hasConflicts == _hasConflicts)) { // nothing to do return; } _action = action; _hasConflicts = hasConflicts; // remove old controls ButtonContainer.Controls.Clear(); if ((_action == GitAction.None) && !_hasConflicts) { Visible = false; return; } IconBox.Image = _hasConflicts ? Properties.Images.SolveMerge : Properties.Resources.information; BackColor = (_hasConflicts ? System.Drawing.Color.Orange : System.Drawing.Color.LightSkyBlue).AdaptBackColor(); TextLabel.SetForeColorForBackColor(); string actionStr = ""; switch (_action) { case GitAction.Bisect: actionStr = _bisect.Text; ButtonContainer.Controls.Add(MoreButton); break; case GitAction.Rebase: actionStr = _rebase.Text; ButtonContainer.Controls.Add(_hasConflicts ? ResolveButton : ContinueButton); ButtonContainer.Controls.Add(AbortButton); ButtonContainer.Controls.Add(MoreButton); break; case GitAction.Merge: actionStr = _merge.Text; ButtonContainer.Controls.Add(_hasConflicts ? ResolveButton : ContinueButton); ButtonContainer.Controls.Add(AbortButton); break; case GitAction.Patch: actionStr = _patch.Text; ButtonContainer.Controls.Add(_hasConflicts ? ResolveButton : ContinueButton); ButtonContainer.Controls.Add(AbortButton); ButtonContainer.Controls.Add(MoreButton); break; case GitAction.None: // can only get here if hasConflicts so add resolve button ButtonContainer.Controls.Add(ResolveButton); break; } TextLabel.Text = (_action == GitAction.None) ? _conflictsMessage.Text : string.Format( _hasConflicts ? _progressWithConflictsMessage.Text : _progressMessage.Text, actionStr); ControlDpiExtensions.AdjustForDpiScaling(this); Visible = true; }
internal void SetGitAction(GitAction action, bool conflicts) => _interactiveGitActionControl.SetGitAction(action, conflicts);