upload
This commit is contained in:
205
MainWindow.xaml
Normal file
205
MainWindow.xaml
Normal file
@@ -0,0 +1,205 @@
|
||||
<Window x:Class="Lab9.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:Lab9"
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow"
|
||||
Height="760"
|
||||
Width="1280"
|
||||
MinHeight="720"
|
||||
MinWidth="1180"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Background="#FFF4F6F8">
|
||||
<Grid Margin="14">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="370"/>
|
||||
<ColumnDefinition Width="14"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Grid.Column="0"
|
||||
Background="White"
|
||||
CornerRadius="10"
|
||||
Padding="14"
|
||||
BorderBrush="#FFD6DCE2"
|
||||
BorderThickness="1">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<StackPanel>
|
||||
<TextBlock FontSize="22"
|
||||
FontWeight="Bold"
|
||||
Margin="0,0,0,6"
|
||||
Text="Сортировка массивов"/>
|
||||
<TextBlock Foreground="#FF5C6B7A"
|
||||
Margin="0,0,0,16"
|
||||
TextWrapping="Wrap">
|
||||
Вариант: TimSort, MSD, Коммунистическая сортировка.
|
||||
Выполнено по паттерну «Стратегия», плюс переключение направления сортировки.
|
||||
</TextBlock>
|
||||
|
||||
<GroupBox Header="Генерация массива">
|
||||
<StackPanel>
|
||||
<TextBlock Margin="0,0,0,6" Text="Количество элементов массива"/>
|
||||
<Slider x:Name="ElementCountSlider"
|
||||
Minimum="5"
|
||||
Maximum="150"
|
||||
TickFrequency="5"
|
||||
IsSnapToTickEnabled="True"
|
||||
Value="20"
|
||||
ValueChanged="ElementCountSlider_ValueChanged"/>
|
||||
<DockPanel Margin="0,10,0,0">
|
||||
<TextBlock VerticalAlignment="Center" Text="Текущее значение:"/>
|
||||
<TextBox x:Name="ElementCountTextBox"
|
||||
Width="70"
|
||||
Margin="10,0,0,0"
|
||||
Text="20"
|
||||
HorizontalContentAlignment="Center"
|
||||
TextChanged="ElementCountTextBox_TextChanged"/>
|
||||
</DockPanel>
|
||||
|
||||
<Button Content="Сгенерировать массив"
|
||||
Background="#FF2793FF"
|
||||
Foreground="White"
|
||||
Click="GenerateArray_Click"/>
|
||||
<Button Content="Массив из файла"
|
||||
Background="#FF7F8C9A"
|
||||
Foreground="White"
|
||||
Click="LoadFromFile_Click"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Методы сортировки">
|
||||
<StackPanel>
|
||||
<RadioButton x:Name="TimSortRadioButton"
|
||||
Content="TimSort"
|
||||
IsChecked="True"
|
||||
Margin="0,0,0,6"/>
|
||||
<RadioButton x:Name="MsdRadioButton"
|
||||
Content="MSD Radix Sort"
|
||||
Margin="0,0,0,6"/>
|
||||
<RadioButton x:Name="CommunistRadioButton"
|
||||
Content="Коммунистическая сортировка"
|
||||
Margin="0,0,0,8"/>
|
||||
<CheckBox x:Name="DescendingCheckBox"
|
||||
Content="Сортировать по убыванию"
|
||||
ToolTip="Если флажок снят, сортировка выполняется по возрастанию."/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Header="Результат сортировки">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="185"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Количество сравнений:"/>
|
||||
<TextBlock Grid.Row="0" Grid.Column="1" x:Name="ComparisonsTextBlock" Text="0"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Margin="0,6,0,0" Text="Количество пересылок:"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Margin="0,6,0,0" x:Name="MovesTextBlock" Text="0"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Margin="0,6,0,0" Text="Время сортировки:"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Margin="0,6,0,0" x:Name="ElapsedTextBlock" Text="00:00:00.000"/>
|
||||
|
||||
<TextBlock Grid.Row="3"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="0,10,0,0"
|
||||
Foreground="#FF8A5A00"
|
||||
TextWrapping="Wrap"
|
||||
Text="Для MSD число сравнений может быть нулевым, потому что алгоритм не основан на сравнении ключей."/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<Button Content="Начать сортировку"
|
||||
Background="#FF1E9C58"
|
||||
Foreground="White"
|
||||
Click="StartSorting_Click"/>
|
||||
|
||||
<Button Content="Очистить значения"
|
||||
Background="#FFE74C3C"
|
||||
Foreground="White"
|
||||
Click="Clear_Click"/>
|
||||
|
||||
<Button Content="Сохранить в файл"
|
||||
Background="#FF1F3BFF"
|
||||
Foreground="White"
|
||||
Click="SaveToFile_Click"/>
|
||||
|
||||
<Button Content="Анализ методов сортировки"
|
||||
Background="#FFF39C12"
|
||||
Foreground="Black"
|
||||
Click="OpenAnalysis_Click"/>
|
||||
|
||||
<Border Background="#FFF8F9FB"
|
||||
BorderBrush="#FFD6DCE2"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Padding="10"
|
||||
Margin="0,10,0,0">
|
||||
<TextBlock TextWrapping="Wrap"
|
||||
Foreground="#FF45525F">
|
||||
Коммунистическая сортировка реализована как отдельный метод обработки массива
|
||||
с приведением элементов к общему значению.
|
||||
</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Column="2"
|
||||
Background="White"
|
||||
CornerRadius="10"
|
||||
Padding="14"
|
||||
BorderBrush="#FFD6DCE2"
|
||||
BorderThickness="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="14"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock FontSize="20"
|
||||
FontWeight="Bold"
|
||||
Text="Пошаговая демонстрация работы алгоритма"/>
|
||||
|
||||
<Border Grid.Row="1"
|
||||
Margin="0,12,0,0"
|
||||
Background="#FFF8F9FB"
|
||||
BorderBrush="#FFD6DCE2"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Padding="10">
|
||||
<StackPanel>
|
||||
<TextBlock FontWeight="SemiBold" Text="Исходный / текущий массив"/>
|
||||
<TextBlock x:Name="ArrayPreviewTextBlock"
|
||||
Margin="0,6,0,0"
|
||||
FontFamily="Consolas"
|
||||
TextWrapping="Wrap"
|
||||
Text="Массив ещё не сформирован."/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<RichTextBox x:Name="LogRichTextBox"
|
||||
Grid.Row="3"
|
||||
FontFamily="Consolas"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsReadOnly="True"
|
||||
IsDocumentEnabled="False"
|
||||
Background="#FFFCFCFD"
|
||||
BorderThickness="0"
|
||||
Padding="8"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user