コード例 #1
0
ファイル: ContactsService.cs プロジェクト: nazzi88ua/Unigram
        public async Task ExportAsync(TLContactsContacts result)
        {
            using (await _syncLock.WaitAsync())
            {
                Debug.WriteLine("» Exporting contacts");

                var store = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AppContactsReadWrite);

                if (store == null)
                {
                    return;
                }

                var contactList = await GetContactListAsync(store);

                var annotationList = await GetAnnotationListAsync();

                if (contactList != null && annotationList != null)
                {
                    await ExportAsync(contactList, annotationList, result);
                }

                Debug.WriteLine("» Exporting contacts completed");
            }
        }
コード例 #2
0
        public override async void RaisePropertyChanged([CallerMemberName] string propertyName = null)
        {
            base.RaisePropertyChanged(propertyName);

            if (propertyName.Equals(nameof(IsContactsSyncEnabled)))
            {
                if (IsContactsSyncEnabled)
                {
                    var contacts = CacheService.GetContacts();
                    var response = new TLContactsContacts {
                        Users = new TLVector <TLUserBase>(contacts)
                    };

                    await _contactsService.ExportAsync(response);
                }
                else
                {
                    await _contactsService.RemoveAsync();
                }
            }
        }