private void m_btnUpdateFromBundle_Click(object sender, EventArgs e) { using (var dlg = new SelectProjectDlg(false, m_model.BundlePath)) { if (dlg.ShowDialog() == DialogResult.OK) { var selectedBundlePath = dlg.FileName; var bundle = new GlyssenBundle(selectedBundlePath); if (ConfirmProjectUpdateFromBundle(bundle)) { m_model.BundlePath = dlg.FileName; UpdatedBundle = bundle; HandleOkButtonClick(sender, e); } else { Analytics.Track("CancelledUpdateProjectFromBundleData", new Dictionary <string, string> { { "bundleLanguage", bundle.LanguageIso }, { "projectLanguage", m_model.IsoCode }, { "bundleID", bundle.Id }, { "projectID", m_model.PublicationId }, { "recordingProjectName", m_model.RecordingProjectName }, { "bundlePathChanged", (m_model.BundlePath != selectedBundlePath).ToString() } }); bundle.Dispose(); } } } }
public static bool GiveUserChanceToFindOriginalBundle(Project project) { using (var dlg = new SelectProjectDlg(false)) if (dlg.ShowDialog() == DialogResult.OK) { string invalidMessage = LocalizationManager.GetString("File.InvalidBundleMsg", "The selected file is not a valid text bundle. Would you like to try again?"); string invalidCaption = LocalizationManager.GetString("File.InvalidBundleMsg", "Invalid Bundle"); string bundlePath = dlg.FileName; if (Path.GetExtension(bundlePath) == DblBundleFileUtils.kDblBundleExtension) { try { var bundle = new GlyssenBundle(bundlePath); if (bundle.Id != project.Id) { string message = LocalizationManager.GetString("File.WrongBundleMsg", "The ID of the selected text bundle does not match this project. Would you like to try again?"); string caption = LocalizationManager.GetString("File.WrongBundle", "Wrong Bundle"); return(ErrorMessageWithRetry(message, caption, project)); } project.OriginalBundlePath = bundlePath; return(true); } catch { return(ErrorMessageWithRetry(invalidMessage, invalidCaption, project)); } } return(ErrorMessageWithRetry(invalidMessage, invalidCaption, project)); } return(false); }
private void m_linkTextReleaseBundle_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { using (var dlg = new SelectProjectDlg()) { if (dlg.ShowDialog() == DialogResult.OK) { SelectedProject = dlg.FileName; if (Path.GetExtension(SelectedProject) == Constants.kProjectFileExtension) { Type = ProjectType.ExistingProject; } else { Type = ProjectType.TextReleaseBundle; } DialogResult = DialogResult.OK; Close(); } } }