Exemplo n.º 1
0
        private void ListBoxGetCodeItem_OnSelected(object sender, RoutedEventArgs e)
        {
            if (!(e.Source is ListBoxItem listBoxItem))
            {
                return;
            }
            var path  = "ViewCode";
            var title = "";

            switch (listBoxItem.Name)
            {
            case "GetCodeLinearSearch":
                title = "Linear Search";
                path += "/LinearSearch.txt";
                break;

            case "GetCodeBinarySearch":
                title = "Binary Search";
                path += "/BinarySearch.txt";
                break;

            case "GetCodeInterpolationSearch":
                title = "Interpolation Search";
                path += "/InterpolationSearch.txt";
                break;

            case "GetCodeInterchangeSort":
                title = "Interchange Sort";
                path += "/InterchangeSort.txt";
                break;

            case "GetCodeBubbleSort":
                title = "Bubble Sort";
                path += "/BubbleSort.txt";
                break;

            case "GetCodeSelectionSort":
                title = "Selection Sort";
                path += "/SelectionSort.txt";
                break;

            case "GetCodeInsertionSort":
                title = "Insertion Sort";
                path += "/InsertionSort.txt";
                break;

            case "GetCodeHeapSort":
                title = "Heap Sort";
                path += "/HeapSort.txt";
                break;

            case "GetCodeMergeSort":
                title = "Merge Sort";
                path += "/MergeSort.txt";
                break;

            case "GetCodeQuickSort":
                title = "Quick Sort";
                path += "/QuickSort.txt";
                break;

            default:
                path += "LinearSearch.txt";
                break;
            }

            var viewCode = new ViewCode(title, path);

            viewCode.ShowDialog();
        }