private async void OnFileSelected(bool success) { if (_datFile != null) { _datFile.Flush(); _datFile.Dispose(); _datFile = null; } if (success) { buttonSource.Text = @"Выбран файл: " + _fileDialog.SafeFileName; panelWhole.Enabled = false; progressBar.Visible = true; progressBar.MarqueeAnimationSpeed = 100; await ReadAsync(); panelWhole.Enabled = true; progressBar.Visible = false; progressBar.MarqueeAnimationSpeed = 0; } else { buttonSource.Text = @"Выберите файл (.dat)"; } buttonExtract.Enabled = success; }