Exemple #1
0
        /// <summary>
        /// Handler for operations with array (sortes)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ArraySortes(object sender, EventArgs e)
        {
            try
            {
                string senderName = ((Button)sender).Name;
                string sortName   = senderName.Replace("SortButton", "");

                string   inputString = ValueOneInput.Text;
                double[] arrayToSort = MyValidator.ValidateAndConvertToArray(inputString);

                ISort ArraySort = ArraySortesFactory.CreateSort(sortName);

                double[] sortedArray = ArraySort.Sort(arrayToSort);
                OutputField.Text = ArrayHelpers.ArrayToString(sortedArray, ' ');
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message, "Error");
            }
        }