private void RefreshStatus() { if (File.Exists(textPath.Text)) { btnAddFastaFile.Enabled = true; ProteomeDb proteomeDb = null; try { using (var longWaitDlg = new LongWaitDlg { Text = Resources.BuildBackgroundProteomeDlg_RefreshStatus_Loading_Proteome_File, Message = string.Format( Resources.BuildBackgroundProteomeDlg_RefreshStatus_Loading_protein_information_from__0__, textPath.Text) }) { longWaitDlg.PerformWork(this, 1000, () => proteomeDb = ProteomeDb.OpenProteomeDb(textPath.Text)); } if (proteomeDb == null) { throw new Exception(); } int proteinCount = proteomeDb.GetProteinCount(); var digestions = proteomeDb.ListDigestions(); tbxStatus.Text = string.Format( Resources.BuildBackgroundProteomeDlg_RefreshStatus_The_proteome_file_contains__0__proteins, proteinCount); if (proteinCount != 0 && digestions.Count > 0) { tbxStatus.Text = TextUtil.LineSeparate(tbxStatus.Text, Resources.BuildBackgroundProteomeDlg_RefreshStatus_The_proteome_has_already_been_digested); } } catch (Exception) { tbxStatus.Text = Resources.BuildBackgroundProteomeDlg_OkDialog_The_proteome_file_is_not_valid; btnAddFastaFile.Enabled = false; } finally { if (null != proteomeDb) { proteomeDb.Dispose(); } } } else { btnAddFastaFile.Enabled = false; tbxStatus.Text = Resources.BuildBackgroundProteomeDlg_RefreshStatus_Click_the_Open_button_to_choose_an_existing_proteome_file_or_click_the_Create_button_to_create_a_new_proteome_file; } }