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); }