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; }
private void PrepareOpenedDatFile(DatFile oldDatFile, DatFile newDatFile) { if (newDatFile == null) { return; } if (oldDatFile != null) { oldDatFile.CalibrChange -= datFile_CalibrChange; oldDatFile.Dispose(); } newDatFile.CalibrChange += datFile_CalibrChange; LoadCalibrList(); var path = newDatFile.Path; if (openedDatFile.Contains(path)) { openedDatFile.Remove(path); } openedDatFile.Insert(0, path); LoadOpenedDatFilesComboBox(); }