I have a WPF application that reads a huge text file and shows it to textbox, but I need to know that all the file has been read before changing the normalize button to visible.
My question is how can I know that all the file was read and displayed in the textbox (is means that the textbox is still changing) and just after assign the button to visible?
try
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
{
using (StreamReader sr = new StreamReader(openFileDialog.FileName))
{
FileBuff = await sr.ReadToEndAsync();
txtEditor.Text = FileBuff;
Normalize_button.IsEnabled = true;
}
}
}
catch (Exception ex)
{
UiInvoke(() => txtEditor.Text = "Could not read the file");
}