/// <summary> /// Event handler when the Sort button is clicked. /// 1. Sets up the state by looking at the radiobutton group. /// 2. Also copies state of the data type, concurrency index and the comparator size /// 3. Creates a delegate to process the native sort algorithm asynchnronously /// </summary> private void OnDoSortButton(object sender, RoutedEventArgs e) { ResetFill(); SetRectBackground(); if (rbParallelSort.IsChecked.Value == true) { sortType = SortSelection.PplParallelSort; } else if (rbParallelBufferedSort.IsChecked.Value == true) { sortType = SortSelection.PplParallelBufferedSort; } else if (rbParallelRadixSort.IsChecked.Value == true) { sortType = SortSelection.PplParallelRadixSort; } else if (rbStdSort.IsChecked.Value == true) { sortType = SortSelection.StdSort; } dataType = (DataTypeSelection)lstDataSetType.SelectedIndex; concurrency = System.Convert.ToInt32(txtConcurrency.Text); if (concurrency <= 0) { concurrency = 1; txtConcurrency.Text = "1"; } comparatorSize = sldComparatorSize.Value; done = false; AppDelegate sd = new AppDelegate(ExecuteSort); sd.BeginInvoke(null, null); UpdateBackground(); }
/// <summary> /// Event handler when the Sort button is clicked. /// 1. Sets up the state by looking at the radiobutton group. /// 2. Also copies state of the data type, concurrency index and the comparator size /// 3. Creates a delegate to process the native sort algorithm asynchnronously /// </summary> private void OnDoSortButton(object sender, RoutedEventArgs e) { ResetFill(); SetRectBackground(); if (rbParallelSort.IsChecked.Value == true) sortType = SortSelection.PplParallelSort; else if (rbParallelBufferedSort.IsChecked.Value == true) sortType = SortSelection.PplParallelBufferedSort; else if (rbParallelRadixSort.IsChecked.Value == true) sortType = SortSelection.PplParallelRadixSort; else if (rbStdSort.IsChecked.Value == true) sortType = SortSelection.StdSort; dataType = (DataTypeSelection)lstDataSetType.SelectedIndex; concurrency = System.Convert.ToInt32(txtConcurrency.Text); if (concurrency <= 0) { concurrency = 1; txtConcurrency.Text = "1"; } comparatorSize = sldComparatorSize.Value; done = false; AppDelegate sd = new AppDelegate(ExecuteSort); sd.BeginInvoke(null, null); UpdateBackground(); }