/// ------------------------------------------------------------------------------------ public Session(string parentElementFolder, string id, Action <ProjectElement, string, string> idChangedNotificationReceiver, SessionFileType sessionFileType, Func <ProjectElement, string, ComponentFile> componentFileFactory, XmlFileSerializer xmlFileSerializer, ProjectElementComponentFile.Factory prjElementComponentFileFactory, IEnumerable <ComponentRole> componentRoles, PersonInformant personInformant, Project project) : base(parentElementFolder, id, idChangedNotificationReceiver, sessionFileType, componentFileFactory, xmlFileSerializer, prjElementComponentFileFactory, componentRoles) { _personInformant = personInformant; // ReSharper disable DoNotCallOverridableMethodsInConstructor // Using a 1-minute fudge factor is a bit of a kludge, but when a session is created from an // existing media file, it already has an ID, and there's no other way to tell it's "new". if (project != null && (id == null || MetaDataFile.GetCreateDate().AddMinutes(1) > DateTime.Now) && MetaDataFile.GetStringValue(SessionFileType.kCountryFieldName, null) == null && MetaDataFile.GetStringValue(SessionFileType.kRegionFieldName, null) == null && MetaDataFile.GetStringValue(SessionFileType.kContinentFieldName, null) == null && MetaDataFile.GetStringValue(SessionFileType.kAddressFieldName, null) == null) { // SP-876: Project Data not displayed in new sessions until after a restart. Program.SaveProjectMetadata(); if (!string.IsNullOrEmpty(project.Country)) { MetaDataFile.TrySetStringValue(SessionFileType.kCountryFieldName, project.Country); } if (!string.IsNullOrEmpty(project.Region)) { MetaDataFile.TrySetStringValue(SessionFileType.kRegionFieldName, project.Region); } if (!string.IsNullOrEmpty(project.Continent)) { MetaDataFile.TrySetStringValue(SessionFileType.kContinentFieldName, project.Continent); } if (!string.IsNullOrEmpty(project.Location)) { MetaDataFile.TrySetStringValue(SessionFileType.kAddressFieldName, project.Location); } } if (string.IsNullOrEmpty(MetaDataFile.GetStringValue(SessionFileType.kGenreFieldName, null))) { if (MetaDataFile.TrySetStringValue(SessionFileType.kGenreFieldName, GenreDefinition.UnknownType.Name)) { MetaDataFile.Save(); } } // ReSharper restore DoNotCallOverridableMethodsInConstructor if (_personInformant != null) { _personInformant.PersonNameChanged += HandlePersonsNameChanged; _personInformant.PersonUiIdChanged += HandlePersonsUiIdChanged; } }
/// ------------------------------------------------------------------------------------ private bool GetShouldReportHaveConsent() { var allParticipants = MetaDataFile.GetStringValue(SessionFileType.kParticipantsFieldName, string.Empty); var personNames = FieldInstance.GetMultipleValuesFromText(allParticipants).ToArray(); bool allParticipantsHaveConsent = personNames.Length > 0; return(personNames.All(name => _personInformant.GetHasInformedConsent(name)) && allParticipantsHaveConsent); }
/// ------------------------------------------------------------------------------------ public void SetAdditionalMetsData(RampArchivingDlgViewModel model) { model.SetScholarlyWorkType(ScholarlyWorkType.PrimaryData); model.SetDomains(SilDomain.Ling_LanguageDocumentation); var value = MetaDataFile.GetStringValue(SessionFileType.kDateFieldName, null); if (!string.IsNullOrEmpty(value)) { model.SetCreationDate(value); } // Return the session's note as the abstract portion of the package's description. value = MetaDataFile.GetStringValue(SessionFileType.kSynopsisFieldName, null); if (!string.IsNullOrEmpty(value)) { model.SetAbstract(value, string.Empty); } // Set contributors var contributions = MetaDataFile.GetValue(SessionFileType.kContributionsFieldName, null) as ContributionCollection; if (contributions != null && contributions.Count > 0) { model.SetContributors(contributions); } // Return total duration of source audio/video recordings. TimeSpan totalDuration = GetTotalDurationOfSourceMedia(); if (totalDuration.Ticks > 0) { model.SetAudioVideoExtent(string.Format("Total Length of Source Recordings: {0}", totalDuration.ToString())); } //model.SetSoftwareRequirements("SayMore"); }
/// ------------------------------------------------------------------------------------ public virtual IEnumerable <string> GetAllParticipants() { var allParticipants = MetaDataFile.GetStringValue(SessionFileType.kParticipantsFieldName, string.Empty); return(FieldInstance.GetMultipleValuesFromText(allParticipants)); }