38 lines
961 B
C#
38 lines
961 B
C#
using System.Collections.ObjectModel;
|
|
using TextSortWindow;
|
|
|
|
namespace TextSort
|
|
{
|
|
public partial class Window : Form, ISortWindow
|
|
{
|
|
public string InputText => InputTextBox.Text;
|
|
public string SelectedStrategy => SortAlgorithmComboBox.SelectedItem?.ToString() ?? "";
|
|
public event EventHandler? SortButtonClicked;
|
|
|
|
public Window()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void DisplaySortedText(string sortedText)
|
|
{
|
|
OutputLabel.Text = sortedText;
|
|
}
|
|
|
|
public void DisplayTime(double milliseconds)
|
|
{
|
|
TimeLabel.Text = $"{milliseconds} ms";
|
|
}
|
|
|
|
public void SetSortOptions(List<string> options)
|
|
{
|
|
SortAlgorithmComboBox.DataSource = options;
|
|
}
|
|
|
|
private void SortButton_Click(object sender, EventArgs e)
|
|
{
|
|
SortButtonClicked?.Invoke(this, EventArgs.Empty);
|
|
}
|
|
}
|
|
}
|