async Task PlatformAnnotate(NGContact contact, NGAnnotations annotations) { ContactAnnotationOperations winAnnotations = (ContactAnnotationOperations)annotations; if (winAnnotations == ContactAnnotationOperations.None) { winAnnotations = ContactAnnotationOperations.ContactProfile; } // Annotate this contact with a remote ID, which you can then retrieve when the Contact Panel is activated. var contactAnnotation = new ContactAnnotation { ContactId = contact.Id, RemoteId = contact.RemoteId, SupportedOperations = winAnnotations }; // Annotate that this contact can load this app's Contact Panel or Contact Share. var infos = await AppDiagnosticInfo.RequestInfoForAppAsync(); contactAnnotation.ProviderProperties.Add("ContactPanelAppID", infos[0].AppInfo.AppUserModelId); if ((winAnnotations & ContactAnnotationOperations.Share) == ContactAnnotationOperations.Share) { contactAnnotation.ProviderProperties.Add("ContactShareAppID", infos[0].AppInfo.AppUserModelId); } var annotationList = await FindOrRegisterAnnotationList(); await annotationList.TrySaveAnnotationAsync(contactAnnotation); }
async Task <string> PlatformGetRemoteId(NGContact contact) { var winContact = contact.ToContact(); var store = await ContactManager.RequestAnnotationStoreAsync(ContactAnnotationStoreAccessType.AppAnnotationsReadWrite); var contactAnnotations = await store.FindAnnotationsForContactAsync(winContact); return(contactAnnotations.FirstOrDefault()?.RemoteId ?? string.Empty); }
async Task PlatformCreateContact(NGContact contact, string listName) { var winContact = contact.ToContact(); var contactList = await FindOrRegisterContactList(listName); await contactList.SaveContactAsync(winContact); contact.Id = winContact.Id; }
async Task PlatformDeleteContact(NGContact contact, string listName) { var winContact = contact.ToContact(); var contactList = await FindOrRegisterContactList(listName); if (contact != null) { await contactList.DeleteContactAsync(winContact); } }
async Task PlatformUnpin(NGContact contact) { var pinnedContactManager = PinnedContactManager.GetDefault(); var winContact = contact.ToContact(); if (pinnedContactManager.IsContactPinned(winContact, PinnedContactSurface.Taskbar)) { await pinnedContactManager.RequestUnpinContactAsync(winContact, PinnedContactSurface.Taskbar); } }
async Task PlatformPin(NGContact contact) { var pinnedContactManager = PinnedContactManager.GetDefault(); // Check whether pinning to the Taskbar is supported. if (!pinnedContactManager.IsPinSurfaceSupported(PinnedContactSurface.Taskbar)) { return; } var winContact = contact.ToContact(); if (pinnedContactManager.IsContactPinned(winContact, PinnedContactSurface.Taskbar)) { // Contact is already pinned return; } await pinnedContactManager.RequestPinContactAsync(winContact, PinnedContactSurface.Taskbar); }
public async Task Unpin(NGContact contact) { await PlatformUnpin(contact); }
public async Task Pin(NGContact contact) { await PlatformPin(contact); }
public async Task <string> GetRemoteId(NGContact contact) { return(await PlatformGetRemoteId(contact)); }
public async Task DeleteContact(NGContact contact, string listName) { await PlatformDeleteContact(contact, listName); }
public async Task Annotate(NGContact contact, NGAnnotations annotations) { await PlatformAnnotate(contact, annotations); }