public string GetCommitMessage( IWin32Window parentWindow, Parameters parameters, string originalMessage) { if (parameters == null) throw new ArgumentNullException("parameters"); try { var project = parameters.Project; if (project.Length == 0) throw new ApplicationException("Missing Google Code project specification."); IList<Issue> issues; using (var dialog = new IssueBrowserDialog { ProjectName = project, UserNamePattern = parameters.User, StatusPattern = parameters.Status, UpdateCheckEnabled = true, }) { var settings = Properties.Settings.Default; new WindowSettings(settings, dialog); var reply = dialog.ShowDialog(parentWindow); issues = dialog.SelectedIssueObjects; settings.Save(); if (reply != DialogResult.OK || issues.Count == 0) return originalMessage; _issues = issues; _project = dialog.Project; } var message = new StringBuilder(originalMessage); if (originalMessage.Length > 0 && !originalMessage.EndsWith("\n")) message.AppendLine(); foreach (var issue in issues) { message .Append("(") .Append(GetIssueTypeAddress(issue.Type)).Append(" issue #") .Append(issue.Id).Append(") : ") .AppendLine(issue.Summary); } return message.ToString(); } catch (Exception e) { ShowErrorBox(parentWindow, e); throw; } }
public string GetCommitMessage( IWin32Window parentWindow, Parameters parameters, string originalMessage) { if (parameters == null) throw new ArgumentNullException("parameters"); _parameters = parameters; var project = parameters.Project; if (project.Length == 0) throw new ApplicationException("Missing project specification."); IList<Issue> issues; using (var dialog = new IssueBrowserDialog(_parameters.Provider) { UserNamePattern = parameters.User, StatusPattern = parameters.Status, UpdateCheckEnabled = true, }) { var settings = Properties.Settings.Default; new WindowSettings(settings, dialog); var reply = dialog.ShowDialog(parentWindow); issues = dialog.SelectedIssueObjects; settings.Save(); if (reply != DialogResult.OK || issues.Count == 0) return originalMessage; _issues = issues; } var message = new StringBuilder(originalMessage); if (originalMessage.Length > 0 && !originalMessage.EndsWith("\n")) message.AppendLine(); foreach (var issue in issues) { var newLine = new StringBuilder(_parameters.CommitTemplate); newLine.Replace("%TYPE%", issue.Type); newLine.Replace("%SUMMARY%", issue.Summary); newLine.Replace("%BUGID%", issue.Id.ToString()); newLine.Replace("%TYPETEXT1%", GetIssueTypeAddress(issue.Type) + "s"); newLine.Replace("%TYPETEXT2%", GetIssueTypeAddress(issue.Type) + "d"); message.Append(newLine + "\n"); } return message.ToString(); }
public string GetCommitMessage( IWin32Window parentWindow, Parameters parameters, string originalMessage) { if (parameters == null) { throw new ArgumentNullException("parameters"); } try { var project = parameters.Project; if (project.Length == 0) { throw new ApplicationException("Missing Google Code project specification."); } IList <Issue> issues; using (var dialog = new IssueBrowserDialog { ProjectName = project, UserNamePattern = parameters.User, StatusPattern = parameters.Status, UpdateCheckEnabled = true, }) { var settings = Properties.Settings.Default; new WindowSettings(settings, dialog); var reply = dialog.ShowDialog(parentWindow); issues = dialog.SelectedIssueObjects; settings.Save(); if (reply != DialogResult.OK || issues.Count == 0) { return(originalMessage); } _issues = issues; _project = dialog.Project; } var message = new StringBuilder(originalMessage); if (originalMessage.Length > 0 && !originalMessage.EndsWith("\n")) { message.AppendLine(); } foreach (var issue in issues) { message .Append("(") .Append(GetIssueTypeAddress(issue.Type)).Append(" issue #") .Append(issue.Id).Append(") : ") .AppendLine(issue.Summary); } return(message.ToString()); } catch (Exception e) { ShowErrorBox(parentWindow, e); throw; } }