public void AsCardListLineTest_After() { string aCFormat = null; bool aDualDated = false; string aNewYear = null; CommonEnums.DateQuality aQuality = CommonEnums.DateQuality.unknown; string aVal = "1939"; CommonEnums.DateValType aValType = CommonEnums.DateValType.after; testVal = new DateObjectModelVal(aVal, aCFormat, aDualDated, aNewYear, aQuality, aValType); CardListLineCollection AsCardListLineTest_After = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_After.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_After[0], "Date:", "after 1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_After[1], "Val:", "1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_After[2], "Type:", "after"); Assert.True(AsCardListLineTest_After.Count == 3); }
public void AsCardListLineTest_DualDated() { string aCFormat = null; bool aDualDated = true; string aNewYear = null; CommonEnums.DateQuality aQuality = CommonEnums.DateQuality.unknown; string aVal = "1939"; CommonEnums.DateValType aValType = CommonEnums.DateValType.unknown; testVal = new DateObjectModelVal(aVal, aCFormat, aDualDated, aNewYear, aQuality, aValType); CardListLineCollection AsCardListLineTest_Basic = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_Basic.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[0], "Date:", "1939 (Dual dated)"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[1], "Val:", "1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[2], "Dual Dated:", "True"); Assert.True(AsCardListLineTest_Basic.Count == 3); }
private CardListLineCollection GetExtraPersonDetails() { // Get extra details CardListLineCollection extraDetailsCard = new CardListLineCollection { new CardListLine("Gender:", PersonObject.GGenderAsString), }; if (PersonObject.BirthDate != null) { if (PersonObject.IsLiving) { extraDetailsCard.Add(new CardListLine("Age:", PersonObject.BirthDate.GetAge)); } else { extraDetailsCard.Add(new CardListLine("Years Since Birth:", PersonObject.BirthDate.GetAge)); EventModel ageAtDeath = DV.EventDV.GetEventType(PersonObject.GEventRefCollection, "Death"); if (ageAtDeath.Valid) { extraDetailsCard.Add(new CardListLine("Age at Death:", ageAtDeath.GDate.DateDifferenceDecoded(PersonObject.BirthDate))); } } } else { extraDetailsCard.Add(new CardListLine("Birth Date:", "Unknown")); } extraDetailsCard.Add(new CardListLine("Is Living:", PersonObject.IsLivingAsString)); return(extraDetailsCard); }
public void AsCardListLineTest_DualDated() { string aCFormat = null; bool aDualDated = true; string aNewYear = null; CommonEnums.DateQuality aQuality = CommonEnums.DateQuality.unknown; string aStart = "1939"; string aStop = "1948"; testVal = new DateObjectModelRange(aStart, aStop, aCFormat, aDualDated, aNewYear, aQuality); CardListLineCollection AsCardListLineTest_Basic = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_Basic.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[0], "Date:", "Between 1939 and 1948 (Dual dated)"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[1], "Start:", "1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[2], "Stop:", "1948"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[3], "Dual Dated:", "True"); Assert.True(AsCardListLineTest_Basic.Count == 4); }
private void HeaderCardLargeRoot_BindingContextChanged(object sender, System.EventArgs e) { if (this.BindingContext is null) { return; } HLinkHeaderModel HeaderData = this.BindingContext as HLinkHeaderModel; Contract.Assert(HeaderData != null); if (HeaderData.Valid) { HeaderCard = new CardListLineCollection { new CardListLine("Created using version:", HeaderData.DeRef.GCreatedVersion), new CardListLine("Created on:", HeaderData.DeRef.GCreatedDate), new CardListLine("Researcher Name:", HeaderData.DeRef.GResearcherName), new CardListLine("Researcher State:", HeaderData.DeRef.GResearcherState), new CardListLine("Researcher Country:", HeaderData.DeRef.GResearcherCountry), new CardListLine("Researcher Email:", HeaderData.DeRef.GResearcherEmail), new CardListLine("MediaPath:", HeaderData.DeRef.GMediaPath), }; } HeaderCard.Title = "Header Details"; this.headerFrame.Content = new ListLineCardLarge { BindingContext = HeaderCard }; }
/// <summary> /// Called when navigation is performed to a page. You can use this method to load state if /// it is available. /// </summary> public override void PopulateViewModel() { BaseEventAggregator.GetEvent <ProgressLoading>().Publish(null); if (DataStore.AD.CurrentDataFolderValid) { DataDetailList = new CardListLineCollection { new CardListLine( "Data Folder:", DataStore.AD.CurrentDataFolder.FullName), }; LocalCanHandleUseExistingFolder = true; } else { DataDetailList = new CardListLineCollection { new CardListLine( "Data Folder:", "Not set"), }; LocalCanHandleUseExistingFolder = false; } }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("AddressDetailViewModel"); AddressObject = DV.AddressDV.GetModelFromHLink(BaseNavParamsHLink); if (AddressObject.Valid) { // Trigger refresh of View fields via INotifyPropertyChanged RaisePropertyChanged(string.Empty); BaseTitle = AddressObject.GetDefaultText; // Get media image MediaCard = AddressObject.HomeImageHLink.ConvertToHLinkMediaModel; // Get Header Details //CardGroup headerCardGroup = new CardGroup { }; // Get the Name Details CardListLineCollection nameDetails = new CardListLineCollection { new CardListLine("Card Type:", "Address Detail"), new CardListLine("Street:", AddressObject.GStreet), new CardListLine("City:", AddressObject.GCity), new CardListLine("Locality:", AddressObject.GLocality), new CardListLine("County:", AddressObject.GCounty), new CardListLine("State:", AddressObject.GState), new CardListLine("Country:", AddressObject.GCountry), new CardListLine("Date:", AddressObject.GDate.ShortDate), new CardListLine("Postal:", AddressObject.GPostal), new CardListLine("Phone:", AddressObject.GPhone), }; // Get date card BaseDetail.Add(AddressObject.GDate.AsCardListLine()); BaseDetail.Add(nameDetails); // Add Standard details BaseDetail.Add(DV.PersonDV.GetModelInfoFormatted(AddressObject)); // Add map card BaseDetail.Add(TurnAddressToURLModel()); // Add header //BaseDetail.Add(headerCardGroup); BaseDetail.Add(AddressObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(AddressObject.GNoteRefCollection.GetCardGroup()); } return; }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("AddressDetailViewModel"); AddressObject = DV.AddressDV.GetModelFromHLink(BaseNavParamsHLink); if (AddressObject.Valid) { BaseTitle = AddressObject.GetDefaultText; // Get media image HLinkHomeImageModel AddressImage = AddressObject.HomeImageHLink; AddressImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(AddressImage); // Get Header Details CardGroup headerCardGroup = new CardGroup { Title = "Address Details" }; // Get the Name Details CardListLineCollection nameDetails = new CardListLineCollection { new CardListLine("Card Type:", "Address Detail"), new CardListLine("Street:", AddressObject.GStreet), new CardListLine("City:", AddressObject.GCity), new CardListLine("Locality:", AddressObject.GLocality), new CardListLine("County:", AddressObject.GCounty), new CardListLine("State:", AddressObject.GState), new CardListLine("Country:", AddressObject.GCountry), new CardListLine("Date:", AddressObject.GDate.ShortDate), new CardListLine("Postal:", AddressObject.GPostal), new CardListLine("Phone:", AddressObject.GPhone), }; headerCardGroup.Add(nameDetails); // Add Standard details headerCardGroup.Add(DV.PersonDV.GetModelInfoFormatted(AddressObject)); // Add map card headerCardGroup.Add(TurnAddressToURLModel()); // Add header BaseDetail.Add(headerCardGroup); BaseDetail.Add(AddressObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(AddressObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(AddressObject.BackHLinkReferenceCollection.GetCardGroup()); } return; }
/// <summary> /// Populates the view ViewModel. /// </summary> public override void PopulateViewModel() { HLinkEventModel HLinkObject = BaseNavParamsHLink as HLinkEventModel; if (!(HLinkObject is null) && (HLinkObject.Valid)) { EventObject = HLinkObject.DeRef; // Trigger refresh of View fields via INotifyPropertyChanged RaisePropertyChanged(string.Empty); if (!(EventObject is null) && (EventObject.Valid)) { BaseTitle = EventObject.GDescription; BaseTitleIcon = CommonConstants.IconEvents; // Get basic details //CardGroup t = new CardGroup { Title = "Header Details" }; BaseDetail.Add(new CardListLineCollection { new CardListLine("Card Type:", "Event Detail"), new CardListLine("Type:", EventObject.GType), new CardListLine("Role", HLinkObject.GRole), new CardListLine("Event Age:", EventObject.GDate.GetAge), }); // Get date card BaseDetail.Add(EventObject.GDate.AsCardListLine()); // Add Model details BaseDetail.Add(DV.EventDV.GetModelInfoFormatted(localEventObject)); // Add the description and event place card CardListLineCollection t1 = new CardListLineCollection { new CardListLine("Description", EventObject.GDescription) }; BaseDetail.Add(t1); BaseDetail.Add(EventObject.GPlace); //BaseDetail.Add(t); BaseDetail.Add(HLinkObject.GAttributeRefCollection); BaseDetail.Add(HLinkObject.GNoteRefCollection.GetCardGroup()); //BaseDetail.Add(EventObject.GAttribute); //BaseDetail.Add(EventObject.GCitationRefCollection.GetCardGroup()); //BaseDetail.Add(EventObject.GMediaRefCollection.GetCardGroup()); //BaseDetail.Add(EventObject.GNoteRefCollection.GetCardGroup()); //BaseDetail.Add(EventObject.GTagRefCollection.GetCardGroup()); } } }
/// <summary> /// Populates the view ViewModel. /// </summary> public override void PopulateViewModel() { HLinkEventModel HLinkObject = BaseNavParamsHLink as HLinkEventModel; if (!(HLinkObject is null) && (HLinkObject.Valid)) { EventObject = HLinkObject.DeRef; if (!(EventObject is null) && (EventObject.Valid)) { BaseTitle = EventObject.GDescription; BaseTitleIcon = CommonConstants.IconEvents; // Get basic details CardGroup t = new CardGroup { Title = "Header Details" }; t.Add(new CardListLineCollection { new CardListLine("Card Type:", "Event Detail"), new CardListLine("Type:", EventObject.GType), new CardListLine("Role", HLinkObject.GRole), new CardListLine("Date:", EventObject.GDate.LongDate), new CardListLine("Event Age:", EventObject.GDate.GetAge), }); // Add Model details t.Add(DV.EventDV.GetModelInfoFormatted(localEventObject)); // Add the description and event place card CardListLineCollection t1 = new CardListLineCollection { new CardListLine("Description", EventObject.GDescription) }; t.Add(t1); t.Add(EventObject.GPlace); BaseDetail.Add(t); BaseDetail.Add(HLinkObject.GAttributeRefCollection); BaseDetail.Add(HLinkObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(EventObject.GAttribute); BaseDetail.Add(EventObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(EventObject.GMediaRefCollection.GetCardGroup()); BaseDetail.Add(EventObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(EventObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(EventObject.BackHLinkReferenceCollection.GetCardGroup()); } } }
public void AsCardListLineTest() { CardListLineCollection AsCardListLineTest_Basic = testVal.AsCardListLine("Test Title"); if (!string.IsNullOrEmpty(AsCardListLineTest_Basic.Title)) { Assert.Fail(); return; } Assert.True(AsCardListLineTest_Basic.Count == 0); }
public static CardListLineCollection GetHLinkInfoFormatted(HLinkBase argHLink) { if (argHLink is null) { throw new ArgumentNullException(nameof(argHLink)); } CardListLineCollection hlinkInfoList = new CardListLineCollection { new CardListLine("Private Object:", argHLink.Priv.ToString()), }; hlinkInfoList.Title = "Admin Details"; return(hlinkInfoList); }
public void AsCardListLineYearMonthDay() { InitYearMonthDay(); CardListLineCollection AsCardListLineTest_Basic = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_Basic.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[0], "Date:", "1939-01-01"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[1], "Str:", "1939-01-01"); Assert.True(AsCardListLineTest_Basic.Count == 2); }
public void AsCardListLineYear() { InitYearOnly(); CardListLineCollection AsCardListLineTest_After = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_After.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_After[0], "Date:", "1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_After[1], "Val:", "1939"); Assert.True(AsCardListLineTest_After.Count == 2); }
public static CardListLineCollection GetModelInfoFormatted(ModelBase argModel) { if (argModel is null) { throw new ArgumentNullException(nameof(argModel)); } CardListLineCollection modelInfoList = new CardListLineCollection { new CardListLine("Id:", argModel.Id), new CardListLine("Change:", argModel.Change.ToString(System.Globalization.CultureInfo.CurrentCulture)), new CardListLine("Private Object:", argModel.Priv.ToString()), }; modelInfoList.Title = "Admin Details"; return(modelInfoList); }
public void TestAsCardListLineYearMonthDay() { InitYearMonthDay(); CardListLineCollection AsCardListLineTest_Basic = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_Basic.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[0], "Date:", "From 1 Jan 1939 to 11 Oct 1948"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[1], "Start:", "1Jan1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[2], "Stop:", "11Oct1948"); Assert.True(AsCardListLineTest_Basic.Count == 3); }
public void TestAsCardListLineYear() { InitYearOnly(); CardListLineCollection AsCardListLineTest_Basic = testVal.AsCardListLine("Test Title"); if (AsCardListLineTest_Basic.Title != "Test Title") { Assert.Fail(); return; } CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[0], "Date:", "Between 1939 and 1948"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[1], "Start:", "1939"); CardListLineUtils.CheckCardListLine(AsCardListLineTest_Basic[2], "Stop:", "1948"); Assert.True(AsCardListLineTest_Basic.Count == 3); }
/// <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. /// /// XML 1.71 all done /// </summary> /// <returns> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("NameDetailViewModel"); HLinkPersonNameModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkPersonNameModel>((BaseParamsHLink)); PersonNameObject = HLinkObject.DeRef; if (PersonNameObject.Valid) { BaseModelBase = PersonNameObject; // Get Header Details CardListLineCollection headerCardGroup = new CardListLineCollection { Title = "Person Name Details" }; headerCardGroup.Add(new CardListLine("Full Name:", PersonNameObject.FullName)); BaseDetail.Add(headerCardGroup); // TODO Show All Surnames CardListLineCollection PersonNameCards = new CardListLineCollection("Name") { new CardListLine("Type:", PersonNameObject.GType), new CardListLine("Full Name:", PersonNameObject.FullName), new CardListLine("Title:", PersonNameObject.GTitle), new CardListLine("FirstName:", PersonNameObject.GFirstName), new CardListLine("Primary SurName:", PersonNameObject.GSurName.GetPrimarySurname), new CardListLine("Suffix:", PersonNameObject.GSuffix), new CardListLine("Alternative:", PersonNameObject.GAlt.ToString()), new CardListLine("Call:", PersonNameObject.GCall), new CardListLine("Display:", PersonNameObject.GDisplay), new CardListLine("Family Nick:", PersonNameObject.GFamilyNick), new CardListLine("Group:", PersonNameObject.GGroup), new CardListLine("Nick:", PersonNameObject.GNick), new CardListLine("Priv:", PersonNameObject.Priv, true), new CardListLine("Sort:", PersonNameObject.GSort) }; BaseDetail.Add(PersonNameCards); // Get date card BaseDetail.Add(PersonNameObject.GDate.AsHLink("Name Date")); foreach (HLinkSurnameModel item in PersonNameObject.GSurName) { CardListLineCollection SurnameCard = new CardListLineCollection("Surnames") { new CardListLine("Surname:", item.ToString()), new CardListLine("Prefix:", item.DeRef.GPrefix), new CardListLine("Primary:", item.DeRef.GPrim), new CardListLine("Derivation:", item.DeRef.GDerivation), new CardListLine("Connector:", item.DeRef.GConnector), }; BaseDetail.Add(SurnameCard); } } return; }
/// <summary> /// Populates the view ViewModel. /// /// XML 1.71 all done /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("NameDetailViewModel"); PersonNameObject = DV.PersonNameDV.GetModelFromHLink(BaseNavParamsHLink); if (PersonNameObject.Valid) { BaseTitle = PersonNameObject.GetDefaultText; // Get media image HLinkHomeImageModel AddressImage = PersonNameObject.HomeImageHLink; AddressImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(AddressImage); // Get Header Details CardGroup headerCardGroup = new CardGroup { Title = "Person Name Details" }; BaseDetail.Add(headerCardGroup); // TODO Show All Surnames CardListLineCollection PersonNameCards = new CardListLineCollection { new CardListLine("Type:", PersonNameObject.GType), new CardListLine("Full Name:", PersonNameObject.FullName), new CardListLine("Title:", PersonNameObject.GTitle), new CardListLine("FirstName:", PersonNameObject.GFirstName), new CardListLine("SurName:", PersonNameObject.GSurName.GetPrimarySurname), new CardListLine("Suffix:", PersonNameObject.GSuffix), new CardListLine("Alt:", PersonNameObject.GAlt.GetDefaultText), new CardListLine("Call:", PersonNameObject.GCall), new CardListLine("Date:", PersonNameObject.GDate.ShortDate), new CardListLine("Display:", PersonNameObject.GDisplay), new CardListLine("Family Nick:", PersonNameObject.GFamilyNick), new CardListLine("Group:", PersonNameObject.GGroup), new CardListLine("Nick:", PersonNameObject.GNick), new CardListLine("Priv:", PersonNameObject.GPriv), new CardListLine("Sort:", PersonNameObject.GSort) }; BaseDetail.Add(PersonNameCards); foreach (SurnameModel item in PersonNameObject.GSurName) { CardListLineCollection SurnameCard = new CardListLineCollection { new CardListLine("Prefix:", item.GPrefix), new CardListLine("Primary:", item.GPrim), new CardListLine("Derivation:", item.GDerivation), new CardListLine("Connector:", item.GConnector), }; BaseDetail.Add(SurnameCard); } BaseDetail.Add(PersonNameObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(PersonNameObject.GNoteReferenceCollection.GetCardGroup()); BaseDetail.Add(PersonNameObject.BackHLinkReferenceCollection.GetCardGroup()); } 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; }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override async Task <bool> PopulateViewModelAsync() { BaseCL.LogRoutineEntry("PersonDetailViewModel"); PersonObject = DV.PersonDV.GetModelFromHLink(BaseNavParamsHLink); if (!(PersonObject is null)) { BaseTitle = PersonObject.GPersonNamesCollection.GetPrimaryName.GetDefaultText; // Get media image HLinkHomeImageModel personImage = PersonObject.HomeImageHLink; 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 Name Details CardListLineCollection nameDetails = new CardListLineCollection { new CardListLine("Card Type:", "Person Detail"), }; headerCardGroup.Add(nameDetails); // Handle the common case where there is only one name if (PersonObject.GPersonNamesCollection.Count == 1) { headerCardGroup.Add(PersonObject.GPersonNamesCollection[0]); } // Get extra details CardListLineCollection extraDetailsCard = new CardListLineCollection { new CardListLine("Gender:", PersonObject.GGenderAsString), }; if (PersonObject.BirthDate != null) { extraDetailsCard.Add(new CardListLine("Birth Date:", PersonObject.BirthDate.GetLongDateAsString)); if (PersonObject.IsLiving) { extraDetailsCard.Add(new CardListLine("Age:", PersonObject.BirthDate.GetAge)); } else { extraDetailsCard.Add(new CardListLine("Years Since Birth:", PersonObject.BirthDate.GetAge)); EventModel ageAtDeath = DV.EventDV.GetEventType(PersonObject.GEventRefCollection, "Death"); if (ageAtDeath.Valid) { extraDetailsCard.Add(new CardListLine("Age at Death:", ageAtDeath.GDate.DateDifferenceDecoded(PersonObject.BirthDate))); } } } else { extraDetailsCard.Add(new CardListLine("Birth Date:", "Unknown")); } extraDetailsCard.Add(new CardListLine("Is Living:", PersonObject.IsLivingAsString)); headerCardGroup.Add(extraDetailsCard); // Get parent details headerCardGroup.Add( new ParentLinkModel { Parents = PersonObject.GChildOf.DeRef, }); // Add Standard details headerCardGroup.Add(DV.PersonDV.GetModelInfoFormatted(PersonObject)); BaseDetail.Add(headerCardGroup); // Handle the uncommon case where there is more than one name if (PersonObject.GPersonNamesCollection.Count > 1) { // Add extra name details BaseDetail.Add(PersonObject.GPersonNamesCollection.GetCardGroup1()); } // Get Bio HLinkNoteModel bioCard = PersonObject.GNoteRefCollection.GetBio; bioCard.CardType = DisplayFormat.NoteCardFull; BaseDetail.Add(bioCard); // Add details BaseDetail.Add(PersonObject.GParentInRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GEventRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GMediaRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GAttributeCollection); BaseDetail.Add(PersonObject.GAddress); BaseDetail.Add(PersonObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(PersonObject.GURLCollection); BaseDetail.Add(PersonObject.GLDSCollection); BaseDetail.Add(PersonObject.GPersonRefCollection); BaseDetail.Add(PersonObject.GPersonNamesCollection.GetPrimaryName.GCitationRefCollection.GetCardGroup("Name Citations")); BaseDetail.Add(PersonObject.GPersonNamesCollection.GetPrimaryName.GNoteReferenceCollection.GetCardGroup("Name Notes")); BaseDetail.Add(PersonObject.BackHLinkReferenceCollection.GetCardGroup()); // TODO localActivitySession = await CommonTimeline.AddToTimeLine("Person", // PersonObject, PersonObject.HomeImageHLink.DeRef.MediaStorageFilePath, "Person: " // + PersonObject.BirthName.FullName, "Born: " + PersonObject.BirthDate.GetShortDateAsString).ConfigureAwait(false); } return(true); }
/// <summary> /// Raises the <see cref="NavigatedTo"/> event. /// </summary> /// <param name="e"> /// The <see cref="NavigatedToEventArgs"/> instance containing the event data. /// </param> /// <param name="viewModelState"> /// State of the view ViewModel. /// </param> /// <returns> /// A <see cref="Task"/> representing the asynchronous operation. /// </returns> public override void PopulateViewModel() { // cache Header Data record HeaderData = DV.HeaderDV.HeaderDataModel.HLink; // Assembly level stuff var assembly = GetType().GetTypeInfo().Assembly; var assemblyName = new AssemblyName(assembly.FullName); CardListLineCollection t = new CardListLineCollection { new CardListLine("Application Name", AppInfo.Name), new CardListLine("Package Name", AppInfo.PackageName), new CardListLine("First Launch Ever?", VersionTracking.IsFirstLaunchEver), new CardListLine("First Launch Current Version?", VersionTracking.IsFirstLaunchForCurrentVersion), new CardListLine("First Launch Current Build?", VersionTracking.IsFirstLaunchForCurrentBuild), new CardListLine("Current Version", VersionTracking.CurrentVersion), new CardListLine("Current Build", VersionTracking.CurrentBuild), new CardListLine("Previous Version", VersionTracking.PreviousVersion), new CardListLine("Previous Build", VersionTracking.PreviousBuild), new CardListLine("First Version Installed", VersionTracking.FirstInstalledVersion), new CardListLine("First Build Installed", VersionTracking.FirstInstalledBuild), // // TODO new CardListLine("versionHistory", VersionTracking.VersionHistory), // // TODO new CardListLine("buildHistory", VersionTracking.BuildHistory), new CardListLine("Major Version", assemblyName.Version.Major), new CardListLine("Minor Version", assemblyName.Version.Minor), new CardListLine("Major Revision", assemblyName.Version.MajorRevision), new CardListLine("Middle Revision", assemblyName.Version.Revision), new CardListLine("Minor Revision", assemblyName.Version.MinorRevision), new CardListLine("App Center update track", Distribute.UpdateTrack.ToString()), }; t.Title = "Application Versions"; ApplicationVersionList = t; // TODO Ugly - Trigger SetProperty //// Set WhatsNew text Set MarkdownView information that is not easily set in XAML //MarkdownTheme tt = new DarkMarkdownTheme //{ // BackgroundColor = CommonRoutines.ResourceColourGet("CardBackGroundNote") //}; //// Check for updates //await Distribute.SetEnabledAsync(true); //Distribute.CheckForUpdate(); return; }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("ChildRefDetailViewModel"); // TODO try again to set this up when the toolkit is a little more mature or I have an // idea where the bug is coming from BaseCurrentLayoutState = LayoutState.Loading; ChildRefHLink = CommonRoutines.GetHLinkParameter <HLinkChildRefModel>((BaseParamsHLink)); PersonObject = ChildRefHLink.DeRef; if (!(PersonObject is null)) { BaseModelBase = PersonObject; // Get media image MediaCard = PersonObject.ModelItemGlyph; // Get the Name Details BaseDetail.Add(PersonObject.GPersonNamesCollection.GetPrimaryName); // Get the Person Details CardListLineCollection nameDetails = GetExtraPersonDetails(); nameDetails.Title = "Child Reference Person Detail"; // handle frel and mrel defaults (according to the gramps source code) nameDetails.Add(new CardListLine("Father Relationship", ChildRefHLink.GFatherRel)); if (string.IsNullOrEmpty(ChildRefHLink.GFatherRel)) { nameDetails.Add(new CardListLine("Father Relationship", "Birth")); } nameDetails.Add(new CardListLine("Mother Relationship", ChildRefHLink.GMotherRel)); if (string.IsNullOrEmpty(ChildRefHLink.GMotherRel)) { nameDetails.Add(new CardListLine("Mother Relationship", "Birth")); } BaseDetail.Add(nameDetails); // Get date card BaseDetail.Add(PersonObject.BirthDate.AsHLink("Birth Date")); // Get parent details BaseDetail.Add( new HLinkParentLinkModel { DeRef = PersonObject.GChildOf.DeRef, }); // Add Standard details BaseDetail.Add(DV.PersonDV.GetModelInfoFormatted(PersonObject)); // If Bio note, display it while showing the full list further below. BioNote = PersonObject.GNoteRefCollection.GetBio; NotesWithoutHighlight = PersonObject.GNoteRefCollection.GetCollectionWithoutOne(BioNote); // Add PersonRefDetails - TODO //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")); //} // _PlatformSpecific.ActivityTimeLineAdd(PersonObject); //// Trigger refresh of View fields via INotifyPropertyChanged //OnPropertyChanged(string.Empty); } // TODO fix this BaseCurrentLayoutState = LayoutState.None; return; }
/// <summary> /// Handles navigation in wards and sets up the event model parameter. /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("MediaDetailViewModel OnNavigatedTo"); CurrentHLinkMedia = BaseNavParamsHLink as HLinkMediaModel; if (!(CurrentHLinkMedia is null)) { CurrentMediaObject = DV.MediaDV.GetModelFromHLink(CurrentHLinkMedia); if (!(CurrentMediaObject is null)) { BaseTitle = CurrentMediaObject.GetDefaultText; BaseTitleIcon = CommonConstants.IconMedia; // Get basic details CardGroup t = new CardGroup { Title = "Header Details" }; t.Add(new CardListLineCollection { new CardListLine("Card Type:", "Media Detail"), new CardListLine("Date:", CurrentMediaObject.GDateValue.GetLongDateAsString), new CardListLine("File Description:", CurrentMediaObject.GDescription), new CardListLine("File Mime Type:", CurrentMediaObject.FileMimeType), new CardListLine("File Content Type:", CurrentMediaObject.FileContentType), new CardListLine("File Mime SubType:", CurrentMediaObject.FileMimeSubType), new CardListLine("OriginalFilePath:", CurrentMediaObject.OriginalFilePath), }); // Set up note re opening in photo app CardListLineCollection t1 = new CardListLineCollection { new CardListLine(string.Empty, "Note: Double click the image to open it.") }; t.Add(t1); // Add standard details t.Add(DV.MediaDV.GetModelInfoFormatted(CurrentMediaObject)); BaseDetail.Add(t); // Get media image HLinkHomeImageModel personImage = CurrentMediaObject.HomeImageHLink; Contract.Assert(CurrentMediaObject.HomeImageHLink != null, CurrentMediaObject.Id); personImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(personImage); // Add HLink Details BaseDetail.Add(CurrentHLinkMedia.GAttributeRefCollection); BaseDetail.Add(CurrentHLinkMedia.GCitationRefCollection.GetCardGroup("HLink Citations")); BaseDetail.Add(CurrentHLinkMedia.GNoteRefCollection.GetCardGroup("HLink Notes")); // Add Model details BaseDetail.Add(CurrentMediaObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(CurrentMediaObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(CurrentMediaObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(CurrentMediaObject.BackHLinkReferenceCollection.GetCardGroup()); } BaseCL.LogRoutineExit("MediaDetailViewModel OnNavigatedTo"); } }
/// <summary> /// Populates the view ViewModel. /// </summary> /// <returns> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("PersonDetailViewModel"); // TODO try again to set this up when the toolkit is a little more mature or I have an // idea where the bug is coming from BaseCurrentLayoutState = LayoutState.Loading; HLinkPersonModel HLinkPerson = CommonRoutines.GetHLinkParameter <HLinkPersonModel>(BaseParamsHLink); PersonObject = HLinkPerson.DeRef; if (!(PersonObject is null)) { BaseModelBase = PersonObject; // Get media image MediaCard = PersonObject.ModelItemGlyph; // Get the Name Details BaseDetail.Add(PersonObject.GPersonNamesCollection.GetPrimaryName); // Get the Person Details CardListLineCollection nameDetails = GetExtraPersonDetails(); nameDetails.Title = "Person Detail"; BaseDetail.Add(nameDetails); // Get date card BaseDetail.Add(PersonObject.BirthDate.AsHLink("Birth Date")); // Get parent details BaseDetail.Add( new HLinkParentLinkModel { DeRef = PersonObject.GChildOf.DeRef, }); // Add Standard details BaseDetail.Add(DV.PersonDV.GetModelInfoFormatted(PersonObject)); // If Bio note, display it while showing the full list further below. BioNote = PersonObject.GNoteRefCollection.GetBio; NotesWithoutHighlight = PersonObject.GNoteRefCollection.GetCollectionWithoutOne(BioNote); // Add PersonRefDetails - TODO //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")); //} } // TODO fix this BaseCurrentLayoutState = LayoutState.None; return; }
/// <summary> /// Populates the view ViewModel. /// /// XML 1.71 all done /// </summary> /// <returns> /// </returns> public override void PopulateViewModel() { BaseCL.LogRoutineEntry("NameDetailViewModel"); PersonNameObject = DV.PersonNameDV.GetModelFromHLink(BaseNavParamsHLink); if (PersonNameObject.Valid) { BaseTitle = PersonNameObject.GetDefaultText; // Trigger refresh of View fields via INotifyPropertyChanged RaisePropertyChanged(string.Empty); // Get media image MediaCard = PersonNameObject.HomeImageHLink.ConvertToHLinkMediaModel; // Get Header Details CardGroup headerCardGroup = new CardGroup { Title = "Person Name Details" }; BaseDetail.Add(headerCardGroup); // TODO Show All Surnames CardListLineCollection PersonNameCards = new CardListLineCollection { new CardListLine("Type:", PersonNameObject.GType), new CardListLine("Full Name:", PersonNameObject.FullName), new CardListLine("Title:", PersonNameObject.GTitle), new CardListLine("FirstName:", PersonNameObject.GFirstName), new CardListLine("SurName:", PersonNameObject.GSurName.GetPrimarySurname), new CardListLine("Suffix:", PersonNameObject.GSuffix), new CardListLine("Alt:", PersonNameObject.GAlt.GetDefaultText), new CardListLine("Call:", PersonNameObject.GCall), new CardListLine("Display:", PersonNameObject.GDisplay), new CardListLine("Family Nick:", PersonNameObject.GFamilyNick), new CardListLine("Group:", PersonNameObject.GGroup), new CardListLine("Nick:", PersonNameObject.GNick), new CardListLine("Priv:", PersonNameObject.GPriv), new CardListLine("Sort:", PersonNameObject.GSort) }; BaseDetail.Add(PersonNameCards); // Get date card BaseDetail.Add(PersonNameObject.GDate.AsCardListLine()); foreach (SurnameModel item in PersonNameObject.GSurName) { CardListLineCollection SurnameCard = new CardListLineCollection { new CardListLine("Prefix:", item.GPrefix), new CardListLine("Primary:", item.GPrim), new CardListLine("Derivation:", item.GDerivation), new CardListLine("Connector:", item.GConnector), }; BaseDetail.Add(SurnameCard); } BaseDetail.Add(PersonNameObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(PersonNameObject.GNoteReferenceCollection.GetCardGroup()); BaseDetail.Add(PersonNameObject.BackHLinkReferenceCollection.GetCardGroup()); } return; }