void RegisterHandoff(Speaker speaker) { var userInfo = new NSMutableDictionary(); userInfo.Add(new NSString("Url"), new NSString(speaker.GetAppLink().AppLinkUri.AbsoluteUri)); var keywords = new NSMutableSet <NSString>(new NSString(speaker.FirstName), new NSString(speaker.LastName)); if (speaker.Sessions != null) { foreach (var session in speaker.Sessions) { keywords.Add(new NSString(session.Title)); } } _activity.Keywords = new NSSet <NSString>(keywords); _activity.WebPageUrl = NSUrl.FromString(speaker.GetWebUrl()); _activity.EligibleForHandoff = false; _activity.AddUserInfoEntries(userInfo); // Provide context var attributes = new CSSearchableItemAttributeSet($"{AboutThisApp.PackageName}.speaker"); attributes.Keywords = keywords.ToArray().Select(k => k.ToString()).ToArray(); attributes.Url = NSUrl.FromString(speaker.GetAppLink().AppLinkUri.AbsoluteUri); _activity.ContentAttributeSet = attributes; }
public void ToArrayTest() { var v1 = (NSString)"1"; using (var st = new NSMutableSet <NSString> (v1)) { var arr = st.ToArray(); Assert.AreEqual(1, arr.Length, "ToArray Length"); Assert.AreSame(v1, arr [0], "ToArray () [0]"); } }
private void RegisterHandoff(TalkModel talkModel) { var userInfo = new NSMutableDictionary(); var uri = new NSString(talkModel.GetAppLink().AppLinkUri.AbsoluteUri); userInfo.Add(new NSString("link"), uri); userInfo.Add(new NSString("Url"), uri); var keywords = new NSMutableSet <NSString>(new NSString(talkModel.Title)); foreach (var speaker in talkModel.Speakers) { keywords.Add(new NSString(speaker.FullName)); } foreach (var category in talkModel.Categories) { keywords.Add(new NSString(category.Name)); } this.activity.Keywords = new NSSet <NSString>(keywords); this.activity.WebPageUrl = NSUrl.FromString(talkModel.GetWebUrl()); this.activity.UserInfo = userInfo; // Provide context var attributes = new CSSearchableItemAttributeSet($"{AboutThisApp.PackageName}.session") { Keywords = keywords.ToArray() .Select( k => k.ToString()) .ToArray(), Url = NSUrl.FromString( talkModel.GetAppLink() .AppLinkUri .AbsoluteUri) }; if (talkModel.StartTime.HasValue && talkModel.StartTime > DateTime.MinValue) { attributes.DueDate = talkModel.StartTime.Value.ToNSDate(); attributes.StartDate = talkModel.StartTime.Value.ToNSDate(); attributes.EndDate = talkModel.EndTime?.ToNSDate(); attributes.ImportantDates = new[] { attributes.StartDate, attributes.EndDate }; } this.activity.ContentAttributeSet = attributes; this.activity.EligibleForHandoff = true; }
private void RegisterHandoff(SpeakerModel speakerModel) { var userInfo = new NSMutableDictionary { { new NSString("Url"), new NSString( speakerModel.GetAppLink().AppLinkUri.AbsoluteUri) } }; var keywords = new NSMutableSet <NSString>( new NSString(speakerModel.FullName)); if (speakerModel.Talks != null) { foreach (var session in speakerModel.Talks) { keywords.Add(new NSString(session.Title)); } } this.activity.Keywords = new NSSet <NSString>(keywords); this.activity.WebPageUrl = NSUrl.FromString(speakerModel.GetWebUrl()); this.activity.EligibleForHandoff = false; this.activity.AddUserInfoEntries(userInfo); // Provide context var attributes = new CSSearchableItemAttributeSet($"{AboutThisApp.PackageName}.speaker") { Keywords = keywords.ToArray() .Select( k => k.ToString()) .ToArray(), Url = NSUrl.FromString( speakerModel .GetAppLink() .AppLinkUri .AbsoluteUri) }; this.activity.ContentAttributeSet = attributes; }
void RegisterHandoff(MiniHack entity) { var userInfo = new NSMutableDictionary(); var uri = new NSString(entity.GetAppLink().AppLinkUri.AbsoluteUri); userInfo.Add(new NSString("link"), uri); userInfo.Add(new NSString("Url"), uri); var keywords = new NSMutableSet <NSString>(new NSString(entity.Name)); _activity.Keywords = new NSSet <NSString>(keywords); _activity.UserInfo = userInfo; // Provide context var attributes = new CSSearchableItemAttributeSet($"{AboutThisApp.PackageName}.minihack"); attributes.Keywords = keywords.ToArray().Select(k => k.ToString()).ToArray(); attributes.Url = NSUrl.FromString(entity.GetAppLink().AppLinkUri.AbsoluteUri); _activity.ContentAttributeSet = attributes; _activity.EligibleForHandoff = false; }