示例#1
0
 private static void Main(string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     //Application.Run(new MainForm());
     SortController.MainSortingProgramView();
 }
示例#2
0
        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);
        }