private async void SortBy(SortingBase selectedSorting) { selectedSorting.NumbersUpdated += (s, e) => UpdateGraph(selectedSorting.NumberArray); Working = true; await selectedSorting.Sort().ConfigureAwait(false); Working = false; }
private void StartSorting() { SortingBase sorter = null; if (SelectedSorting is BubbleSort) { sorter = new BubbleSort(Numbers); } else if (SelectedSorting is SelectionSort) { sorter = new SelectionSort(Numbers); } else if (SelectedSorting is InsertionSort) { sorter = new InsertionSort(Numbers); } // ... if (sorter != null) { SortBy(sorter); } }