/// <summary> /// Handles navigation inwards and gets the media model parameter. /// </summary> /// <returns> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("MediaDetailViewModel OnNavigatedTo"); CurrentHLinkMedia = CommonRoutines.GetHLinkParameter <HLinkMediaModel>((BaseParamsHLink)); // For cropped or internal media then show the original image IMediaModel tt = CurrentHLinkMedia.DeRef; if (tt.IsInternalMediaFile) { CurrentHLinkMedia = DV.MediaDV.GetModelFromHLinkKey(tt.InternalMediaFileOriginalHLink).HLink; } if (!(CurrentHLinkMedia is null)) { CurrentMediaObject = CurrentHLinkMedia.DeRef as MediaModel; if (!(CurrentMediaObject is null)) { BaseModelBase = CurrentMediaObject; BaseTitleIcon = Constants.IconMedia; MediaCard = CurrentMediaObject.ModelItemGlyph.ImageHLinkMediaModel; // Get basic details BaseDetail.Add(new CardListLineCollection("Media Detail") { 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), }); // Get date card BaseDetail.Add(CurrentMediaObject.GDateValue.AsHLink("Media Date")); // Add standard details MediaModel t = CurrentMediaObject as MediaModel; BaseDetail.Add(DV.MediaDV.GetModelInfoFormatted(t)); } BaseCL.RoutineExit("MediaDetailViewModel OnNavigatedTo"); } }
/// <summary> /// Populates the view ViewModel by handling the Load Event. /// </summary> /// <returns> /// <br/> /// </returns> public override void HandleViewDataLoadEvent() { BaseCL.RoutineEntry("AddressDetailViewModel"); HLinkAdressModel HLinkObject = CommonRoutines.GetHLinkParameter <HLinkAdressModel>((BaseParamsHLink)); AddressObject = HLinkObject.DeRef; if (AddressObject.Valid) { BaseModelBase = AddressObject; // Get media image MediaCard = AddressObject.ModelItemGlyph.ImageHLinkMediaModel; // Get the Name Details BaseDetail.Add(new CardListLineCollection("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), }); // Add date card BaseDetail.Add(AddressObject.GDate.AsHLink("Address Date")); // Add Map card BaseDetail.Add(AddressObject.ToMapModel().HLink); // Add Standard details BaseDetail.Add(DV.AddressDV.GetModelInfoFormatted(AddressObject)); } return; }
/// <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; }