void BtnSortClick(object sender, EventArgs e) { SortModel sortModel = new SortModel(); sortModel.inputText = tbInput.Text; sortModel.sortStrategy = (SortStrategy)this.cmbStrategy.SelectedValue; List <string> errors = sortModel.validate(); if (errors.Count > 0) { string errorMessage = ""; foreach (string err in errors) { errorMessage = errorMessage + err + "."; } MessageBox.Show(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } tbOutput.Text = SortController.sortTextByStrategy(sortModel); MessageBox.Show("String Sorted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public static string sortTextByStrategy(SortModel sortModel) { return(sortModel.sort()); }