Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        async Task PlatformCreateContact(NGContact contact, string listName)
        {
            var winContact  = contact.ToContact();
            var contactList = await FindOrRegisterContactList(listName);

            await contactList.SaveContactAsync(winContact);

            contact.Id = winContact.Id;
        }
Exemple #4
0
        async Task PlatformDeleteContact(NGContact contact, string listName)
        {
            var winContact  = contact.ToContact();
            var contactList = await FindOrRegisterContactList(listName);

            if (contact != null)
            {
                await contactList.DeleteContactAsync(winContact);
            }
        }
Exemple #5
0
        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);
            }
        }
Exemple #6
0
        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);
        }
Exemple #7
0
 public async Task Unpin(NGContact contact)
 {
     await PlatformUnpin(contact);
 }
Exemple #8
0
 public async Task Pin(NGContact contact)
 {
     await PlatformPin(contact);
 }
Exemple #9
0
 public async Task <string> GetRemoteId(NGContact contact)
 {
     return(await PlatformGetRemoteId(contact));
 }
Exemple #10
0
 public async Task DeleteContact(NGContact contact, string listName)
 {
     await PlatformDeleteContact(contact, listName);
 }
Exemple #11
0
 public async Task Annotate(NGContact contact, NGAnnotations annotations)
 {
     await PlatformAnnotate(contact, annotations);
 }