private HLinkPersonRefModelCollection GetPersonRefCollection(XElement xmlData) { HLinkPersonRefModelCollection t = new HLinkPersonRefModelCollection(); IEnumerable <XElement> theERElement = from ORElementEl in xmlData.Elements(ns + "personref") select ORElementEl; if (theERElement.Any()) { // load person object references foreach (XElement theLoadORElement in theERElement) { HLinkPersonRefModel t2 = new HLinkPersonRefModel { GCitationCollection = GetCitationCollection(theLoadORElement), GNoteCollection = GetNoteCollection(theLoadORElement), GRelationship = GetAttribute(theLoadORElement, "rel"), }; t2.HLinkKey = GetAttribute(theLoadORElement, "hlink"); t.Add(t2); } } return(t); }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("PersonDetailViewModel"); PersonObject = DV.PersonDV.GetModelFromHLink(BaseNavParamsHLink); // Trigger refresh of View fields via INotifyPropertyChanged RaisePropertyChanged(string.Empty); if (!(PersonObject is null)) { BaseTitle = PersonObject.GPersonNamesCollection.GetPrimaryName.DeRef.GetDefaultText; // Get media image MediaCard = PersonObject.HomeImageHLink.ConvertToHLinkMediaModel; // Get Header Details //CardGroup headerCardGroup = new CardGroup { Title = "Header Details" }; // Get the Person Details CardListLineCollection nameDetails = new CardListLineCollection { new CardListLine("Card Type:", "Person Detail"), }; BaseDetail.Add(nameDetails); // Get the Name Details BaseDetail.Add(PersonObject.GPersonNamesCollection.GetPrimaryName.Copy(), argDisplayFormat: DisplayFormat.PersonNameCardSingle); // Get date card BaseDetail.Add(PersonObject.BirthDate.AsCardListLine("Birth Date")); // Get details on persons age etc BaseDetail.Add(GetExtraPersonDetails()); // Get parent details BaseDetail.Add( new ParentLinkModel { Parents = PersonObject.GChildOf.DeRef, }); // Add Standard details BaseDetail.Add(DV.PersonDV.GetModelInfoFormatted(PersonObject)); // BaseDetail.Add(headerCardGroup); // Get Bio HLinkNoteModel bioCard = PersonObject.GNoteRefCollection.GetBio; if (bioCard.Valid) { bioCard.CardType = DisplayFormat.NoteCardFull; BaseDetail.Add(bioCard); } // Add PersonRefDetails if (BaseNavParamsHLink is HLinkPersonRefModel) { HLinkPersonRefModel personRef = (BaseNavParamsHLink as HLinkPersonRefModel); Contract.Assert(personRef != null); BaseDetail.Add(personRef.GCitationCollection.GetCardGroup("PersonRef Citations")); BaseDetail.Add(personRef.GNoteCollection.GetCardGroup("PersonRef Notes")); } // Add details //BaseDetail.Add(PersonObject.GPersonNamesCollection.GetCardGroup()); //BaseDetail.Add(PersonObject.GParentInRefCollection.GetCardGroup()); //BaseDetail.Add(EventsIncFamily()); //BaseDetail.Add(PersonObject.GCitationRefCollection.GetCardGroup()); //BaseDetail.Add(PersonObject.GNoteRefCollection.GetCardGroupWithoutBio()); //BaseDetail.Add(PersonObject.GMediaRefCollection.GetCardGroup()); //BaseDetail.Add(PersonObject.GAttributeCollection); //BaseDetail.Add(PersonObject.GAddress.GetCardGroup()); //BaseDetail.Add(PersonObject.GTagRefCollection.GetCardGroup()); //BaseDetail.Add(PersonObject.GURLCollection); //BaseDetail.Add(PersonObject.GLDSCollection); //BaseDetail.Add(PersonObject.GPersonRefCollection.GetCardGroup()); _PlatformSpecific.ActivityTimeLineAdd(PersonObject); } return; }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("PersonDetailViewModel"); PersonObject = DV.PersonDV.GetModelFromHLink(BaseNavParamsHLink); if (!(PersonObject is null)) { BaseTitle = PersonObject.GPersonNamesCollection.GetPrimaryName.DeRef.GetDefaultText; // Get media image HLinkMediaModel personImage = PersonObject.HomeImageHLink.ConvertToHLinkMediaModel(); Contract.Assert(PersonObject.HomeImageHLink != null, PersonObject.Id); personImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(personImage); // Get Header Details CardGroup headerCardGroup = new CardGroup { Title = "Header Details" }; // Get the Person Details CardListLineCollection nameDetails = new CardListLineCollection { new CardListLine("Card Type:", "Person Detail"), }; headerCardGroup.Add(nameDetails); // Get the Name Details headerCardGroup.Add(PersonObject.GPersonNamesCollection.GetPrimaryName); // Get details on persons age etc headerCardGroup.Add(GetExtraPersonDetails()); // Get parent details headerCardGroup.Add( new ParentLinkModel { Parents = PersonObject.GChildOf.DeRef, }); // Add Standard details headerCardGroup.Add(DV.PersonDV.GetModelInfoFormatted(PersonObject)); BaseDetail.Add(headerCardGroup); // Get Bio HLinkNoteModel bioCard = PersonObject.GNoteRefCollection.GetBio; bioCard.CardType = DisplayFormat.NoteCardFull; BaseDetail.Add(bioCard); // Add PersonRefDetails if (BaseNavParamsHLink is HLinkPersonRefModel) { HLinkPersonRefModel personRef = (BaseNavParamsHLink as HLinkPersonRefModel); Contract.Assert(personRef != null); BaseDetail.Add(personRef.GCitationCollection.GetCardGroup("PersonRef Citations")); BaseDetail.Add(personRef.GNoteCollection.GetCardGroup("PersonRef Notes")); } // Add details BaseDetail.Add(PersonObject.GPersonNamesCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GParentInRefCollection.GetCardGroup()); BaseDetail.Add(EventsIncFamily()); BaseDetail.Add(PersonObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GNoteRefCollection.GetCardGroupWithoutBio()); BaseDetail.Add(PersonObject.GMediaRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GAttributeCollection); BaseDetail.Add(PersonObject.GAddress.GetCardGroup()); BaseDetail.Add(PersonObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GURLCollection); BaseDetail.Add(PersonObject.GLDSCollection); BaseDetail.Add(PersonObject.GPersonRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.BackHLinkReferenceCollection.GetCardGroup()); _PlatformSpecific.ActivityTimeLineAdd(PersonObject); } return; }