public override CardGroup GetLatestChanges() { DateTime lastSixtyDays = DateTime.Now.Subtract(new TimeSpan(60, 0, 0, 0, 0)); IEnumerable tt = DataViewData.OrderByDescending(GetLatestChangest => GetLatestChangest.Change).Where(GetLatestChangestt => GetLatestChangestt.Change > lastSixtyDays).Take(3); CardGroup returnCardGroup = new CardGroup(); foreach (EventModel item in tt) { returnCardGroup.Add(item.HLink); } returnCardGroup.Title = "Latest Event Changes"; return(returnCardGroup); }
public CardGroup GetAllAsGroupedFamilyNameCardGroup() { CardGroup t = new CardGroup(); // Union on the Father and Mother Surnames first var queryBase = ( from item in DataViewData select new { key = item.GFather.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.GSurName.GetPrimarySurname, item } ) .Union( from item in DataViewData select new { key = item.GMother.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.GSurName.GetPrimarySurname, item } ); var query = from x in queryBase orderby x.key group x by(x.key) into g select new { GroupName = g.Key, Items = g }; foreach (var g in query) { CardGroupBase <HLinkFamilyModel> info = new CardGroupBase <HLinkFamilyModel> { Title = g.GroupName, }; foreach (var item in g.Items) { info.Add(item.item.HLink); } t.Add(info); } return(t); }
public CardGroup GetCardGroupWithoutBio() { CardGroup t = new CardGroup(); HLinkNoteModel bio = GetBio; foreach (HLinkNoteModel item in Items) { if (item.HLinkKey != bio.HLinkKey) { t.Add(item); } } t.Title = Title; return(t); }
/// <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> /// 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> /// Processes the query. /// </summary> /// <param name="argSearch"> /// Search Text. /// </param> /// <param name="argLimit"> /// Search Limit for search terms found while typing. /// </param> public void ProcessQuery(string argSearch, int argLimit) { SearchText = argSearch; //SearchNothingFound = false; BaseDetail.Clear(); CardGroup SearchCards; if (SearchText.Length > 0) { // Create Person Cards SearchCards = new CardGroup { Title = "People" }; foreach (SearchItem item in DV.PersonDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Person Name Cards SearchCards = new CardGroup { Title = "Person Names" }; foreach (SearchItem item in DV.PersonNameDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Family Cards SearchCards = new CardGroup { Title = "Families" }; foreach (SearchItem item in DV.FamilyDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Event Cards SearchCards = new CardGroup { Title = "Events" }; foreach (SearchItem item in DV.EventDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Note cards SearchCards = new CardGroup { Title = "Notes" }; foreach (SearchItem item in DV.NoteDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Address Cards SearchCards = new CardGroup { Title = "Addresses" }; foreach (SearchItem item in DV.AddressDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Citation cards SearchCards = new CardGroup { Title = "Citations" }; foreach (SearchItem item in DV.CitationDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Media Cards SearchCards = new CardGroup { Title = "Media" }; foreach (SearchItem item in DV.MediaDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Place Cards SearchCards = new CardGroup { Title = "Places" }; foreach (SearchItem item in DV.PlaceDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); } if (BaseDetail.Count == 0) { CardGroup tt = new CardGroup(); InstructionCardLarge instructionCard = new InstructionCardLarge { BindingContext = AppResources.SearchPage_NothingFound, }; tt.Add(instructionCard); BaseDetail.Add(tt); } }
/// <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> /// Populates the view ViewModel. /// </summary> /// <returns> /// Task. /// </returns> public override void PopulateViewModel() { FamilyObject = DV.FamilyDV.GetModelFromHLink(BaseNavParamsHLink); if (!(FamilyObject is null)) { BaseTitle = FamilyObject.FamilyDisplayName; BaseTitleIcon = CommonConstants.IconFamilies; // Get media image HLinkHomeImageModel personImage = FamilyObject.HomeImageHLink; Contract.Assert(FamilyObject.HomeImageHLink != null, FamilyObject.Id); personImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(personImage); // Get basic details CardGroup t = new CardGroup { Title = "Header Details" }; t.Add(new CardListLineCollection { new CardListLine("Card Type:", "Family Detail"), new CardListLine("Family Display Name:", FamilyObject.FamilyDisplayName), new CardListLine("Family Relationship:", FamilyObject.GFamilyRelationship), new CardListLine("Father Name:", FamilyObject.GFather.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.FullName), new CardListLine("Mother Name:", FamilyObject.GMother.DeRef.GPersonNamesCollection.GetPrimaryName.DeRef.FullName), }); // Add Model details t.Add(DV.FamilyDV.GetModelInfoFormatted(FamilyObject)); // Add parent link t.Add(new ParentLinkModel { Parents = localFamilyModel, }); BaseDetail.Add(t); // Detail reference BaseDetail.Add(FamilyObject.GEventRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GChildRefCollection.GetCardGroup()); // TODO , "Children"); BaseDetail.Add(FamilyObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GMediaRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.GAttributeCollection); BaseDetail.Add(FamilyObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(FamilyObject.BackHLinkReferenceCollection.GetCardGroup()); string outFamEvent; if (FamilyObject.GEventRefCollection.Count > 0) { // TODO Handle this outFamEvent = FamilyObject.GEventRefCollection.FirstOrDefault().DeRef.GType + ": " + FamilyObject.GEventRefCollection.FirstOrDefault().DeRef.GDate.ShortDate; } // TODO localActivitySession = await CommonTimeline.AddToTimeLine("Family", // localFamilyModel, localFamilyModel.HomeImageHLink.DeRef.MediaStorageFilePath, // "Family: " + localFamilyModel.FamilyDisplayName, outFamEvent).ConfigureAwait(false); // TODO //CommonTimeline.FinishActivitySessionAsync(localActivitySession); } } }
/// <summary> /// Handles navigation in wards and sets up the place model parameter. /// </summary> public override void PopulateViewModel() { PlaceObject = DV.PlaceDV.GetModelFromHLink(BaseNavParamsHLink); if (PlaceObject != null) { BaseTitle = PlaceObject.GetDefaultText; BaseTitleIcon = CommonConstants.IconPlace; // Get Header details CardGroup t = new CardGroup { Title = "Header Details" }; t.Add(new CardListLineCollection { new CardListLine("Card Type:", "Place Detail"), new CardListLine("Title:", PlaceObject.GPTitle), new CardListLine("Name:", PlaceObject.GPlaceNames.GetDefaultText), new CardListLine("Type:", PlaceObject.GType), new CardListLine("Code:", PlaceObject.GCode), }); // Get Coordinates TODO Setup Map link card button thing t = new CardGroup { Title = "Coordinates" }; t.Add(new CardListLineCollection { new CardListLine("Lat:", PlaceObject.GCoordLat), new CardListLine("Long:", PlaceObject.GCoordLong), }); t.Add(DV.PlaceDV.GetModelInfoFormatted(PlaceObject)); BaseDetail.Add(t); // Get Place Name details if (PlaceObject.GPlaceNames.Count > 1) { //t = new CardGroup { Title = "Place Names" }; //foreach (PlaceNameModel item in PlaceObject.GPlaceNames) //{ // t.Add(new CardListLineCollection // { // new CardListLine("Card Type:", "Place Name"), // new CardListLine("Name:", item.GValue), // new CardListLine("Language:", item.GLang), // new CardListLine("Date:", item.GDate.ShortDate), // }); //} BaseDetail.Add(PlaceObject.GPlaceNames); } // Details BaseDetail.Add(PlaceObject.GLocation); BaseDetail.Add(PlaceObject.GPlaceRefCollection.GetCardGroup()); BaseDetail.Add(PlaceObject.PlaceChildCollection.GetCardGroup()); BaseDetail.Add(PlaceObject.GCitationRefCollection.GetCardGroup()); BaseDetail.Add(PlaceObject.GMediaRefCollection.GetCardGroup()); BaseDetail.Add(PlaceObject.GNoteRefCollection.GetCardGroup()); BaseDetail.Add(PlaceObject.GTagRefCollection.GetCardGroup()); BaseDetail.Add(PlaceObject.GURLCollection); BaseDetail.Add(PlaceObject.BackHLinkReferenceCollection.GetCardGroup()); } }
/// <summary> /// Populate the Hub View. /// </summary> public override void PopulateViewModel() { CardGroup tt = new CardGroup(); InstructionCardLarge instructionCard = new InstructionCardLarge { BindingContext = AppResources.HubPage_IntroductionText, }; tt.Add(instructionCard); BaseDetail.Add(tt); // Get Header CardLarge HLinkHeaderModel HeaderCard = DV.HeaderDV.HeaderDataModel.HLink; HeaderCard.CardType = DisplayFormat.HeaderCardLarge; BaseDetail.Add(HeaderCard); IHLinkMediaModel HeroImage = DV.MediaDV.GetRandomFromCollection(null); HeroImage.CardType = DisplayFormat.MediaCardLarge; BaseDetail.Add(HeroImage); if (HeroImage == null) { DataStore.CN.NotifyAlert("No images found in this data. Consider adding some."); } // Setup ToDo list ObservableCollection <INoteModel> t = DV.NoteDV.GetAllOfType(NoteModel.GTypeToDo); CardGroup toDoCardGroup = new CardGroup { Title = "ToDo list" }; foreach (NoteModel item in t) { toDoCardGroup.Add(item.HLink); } BaseDetail.Add(toDoCardGroup); // Setup Latest Changes list // TODO fix this LatestChanges.Add(DV.BookMarkDV.GetLatestChanges()); BaseDetail.Add(DV.CitationDV.GetLatestChanges()); BaseDetail.Add(DV.EventDV.GetLatestChanges()); BaseDetail.Add(DV.FamilyDV.GetLatestChanges()); BaseDetail.Add(DV.MediaDV.GetLatestChanges()); BaseDetail.Add(DV.NoteDV.GetLatestChanges()); BaseDetail.Add(DV.PersonDV.GetLatestChanges()); BaseDetail.Add(DV.PlaceDV.GetLatestChanges()); BaseDetail.Add(DV.SourceDV.GetLatestChanges()); BaseDetail.Add(DV.TagDV.GetLatestChanges()); return; }
/// <summary> /// Processes the query. /// </summary> /// <param name="argSearch"> /// Search Text. /// </param> /// <param name="argLimit"> /// Search Limit for search terms found while typing. /// </param> public void ProcessQuery(string argSearch, int argLimit) { SearchText = argSearch; SearchNothingFound = false; BaseDetail.Clear(); CardGroup SearchCards; if (SearchText.Length > 0) { // Create Person Cards SearchCards = new CardGroup { Title = "People" }; foreach (SearchItem item in DV.PersonDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Family Cards SearchCards = new CardGroup { Title = "Families" }; foreach (SearchItem item in DV.FamilyDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Event Cards SearchCards = new CardGroup { Title = "Events" }; foreach (SearchItem item in DV.EventDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Note cards SearchCards = new CardGroup { Title = "Notes" }; foreach (SearchItem item in DV.NoteDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Citation cards SearchCards = new CardGroup { Title = "Citations" }; foreach (SearchItem item in DV.CitationDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Media Cards SearchCards = new CardGroup { Title = "Media" }; foreach (SearchItem item in DV.MediaDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); // Create Place Cards SearchCards = new CardGroup { Title = "Places" }; foreach (SearchItem item in DV.PlaceDV.Search(SearchText)) { if (SearchCards.Count < argLimit) { SearchCards.Add(item.HLink); } } BaseDetail.Add(SearchCards); } if (BaseDetail.Count == 0) { SearchNothingFound = true; } }