예제 #1
0
                void IAsyncStateMachine.MoveNext()
                {
                    int num1 = this._1__state;

                    try
                    {
                        TaskAwaiter awaiter;
                        if (num1 != 0)
                        {
                            if (this.result.ResultCode == ResultCode.Succeeded)
                            {
                                ContactsCache contactsCache = new ContactsCache();
                                List <string> stringList    = this._4__this.phoneNumbers;
                                contactsCache.PhoneNumbers = stringList;
                                awaiter = ContactsSyncManager.StoreContactsAsync(contactsCache).GetAwaiter();
                                if (!awaiter.IsCompleted)
                                {
                                    this._1__state = 0;
                                    this.u__1      = awaiter;
                                    this.t__builder.AwaitUnsafeOnCompleted <TaskAwaiter, ContactsSyncManager.c__DisplayClass9_0.d>(ref awaiter, ref this);
                                    return;
                                }
                            }
                            else
                            {
                                goto label_7;
                            }
                        }
                        else
                        {
                            awaiter        = this.u__1;
                            this.u__1      = new TaskAwaiter();
                            this._1__state = -1;
                        }
                        awaiter.GetResult();
                        awaiter = new TaskAwaiter();
label_7:
                        this._4__this._4__this._isSynching = false;
                        if (this._4__this.callback != null)
                        {
                            this._4__this.callback();
                        }
                    }
                    catch (Exception ex)
                    {
                        this._1__state = -2;
                        this.t__builder.SetException(ex);
                        return;
                    }
                    this._1__state = -2;
                    this.t__builder.SetResult();
                }
예제 #2
0
        private static async Task <ContactsCache> RetrieveContactsAsync()
        {
            ContactsCache contactsCache = new ContactsCache();

            try
            {
                await CacheManager.TryDeserializeAsync((IBinarySerializable)contactsCache, "SAVED_ContactsPhoneNumbers", CacheManager.DataType.CachedData);
            }
            catch
            {
            }
            return(contactsCache);
        }
예제 #3
0
        public async void Sync(Action callback = null)
        {
            ContactsSyncManager.c__DisplayClass9_0 stateMachine = new ContactsSyncManager.c__DisplayClass9_0();
            stateMachine._4__this = this;
            stateMachine.callback = callback;
            if (!AppGlobalStateManager.Current.GlobalState.AllowSendContacts || this._isSynching)
            {
                if (stateMachine.callback == null)
                {
                    return;
                }
                stateMachine.callback();
            }
            else
            {
                this._isSynching = true;
                ContactsSyncManager.c__DisplayClass9_0 cDisplayClass90_2 = stateMachine;
                List <string> stringList         = cDisplayClass90_2.phoneNumbers;
                List <string> phoneContactsAsync = await ContactsSyncManager.GetPhoneContactsAsync();

                cDisplayClass90_2.phoneNumbers = phoneContactsAsync;
                cDisplayClass90_2 = null;
                if (stateMachine.phoneNumbers == null)
                {
                    if (stateMachine.callback != null)
                    {
                        stateMachine.callback();
                    }
                    this._isSynching = false;
                }
                else
                {
                    ContactsCache contactsCache = await ContactsSyncManager.RetrieveContactsAsync();

                    if (!ContactsSyncManager.AreListsEqual(stateMachine.phoneNumbers, contactsCache.PhoneNumbers))
                    {
                        AccountService.Instance.LookupContacts("phone", "", stateMachine.phoneNumbers, new Action <BackendResult <LookupContactsResponse, ResultCode> >(stateMachine.b__0));
                    }
                    this._isSynching = false;
                    if (stateMachine.callback == null)
                    {
                        return;
                    }
                    stateMachine.callback();
                }
            }
        }
예제 #4
0
        public async void Sync(Action callback = null)
        {
            if (!AppGlobalStateManager.Current.GlobalState.AllowSendContacts || this._isSynching)
            {
                // ISSUE: reference to a compiler-generated field
                if (callback == null)
                {
                    return;
                }
                // ISSUE: reference to a compiler-generated field
                callback.Invoke();
            }
            else
            {
                this._isSynching = true;
                // ISSUE: variable of a compiler-generated type
//        ContactsSyncManager.<>c__DisplayClass9_0 cDisplayClass90_2 = cDisplayClass90_1;
                // ISSUE: reference to a compiler-generated field
//        List<string> phoneNumbers = cDisplayClass90_2.phoneNumbers;
                List <string> phoneContactsAsync = await ContactsSyncManager.GetPhoneContactsAsync();

                // ISSUE: reference to a compiler-generated field
//        cDisplayClass90_2.phoneNumbers = phoneContactsAsync;
//        cDisplayClass90_2 = (ContactsSyncManager.<>c__DisplayClass9_0) null;
                // ISSUE: reference to a compiler-generated field
                if (phoneContactsAsync == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    if (callback != null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        callback.Invoke();
                    }
                    this._isSynching = false;
                }
                else
                {
                    ContactsCache contactsCache = await ContactsSyncManager.RetrieveContactsAsync();

                    // ISSUE: reference to a compiler-generated field
                    if (!ContactsSyncManager.AreListsEqual(phoneContactsAsync, contactsCache.PhoneNumbers))
                    {
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated method
                        // AccountService.Instance.LookupContacts("phone", "", phoneContactsAsync, new Action<BackendResult<LookupContactsResponse, ResultCode>>(cDisplayClass90_1.<Sync>b__0));

                        AccountService.Instance.LookupContacts("phone", "", phoneContactsAsync, async delegate(BackendResult <LookupContactsResponse, ResultCode> result)
                        {
                            if (result.ResultCode == ResultCode.Succeeded)
                            {
                                await ContactsSyncManager.StoreContactsAsync(new ContactsCache
                                {
                                    PhoneNumbers = phoneContactsAsync
                                });
                            }
                            this._isSynching = false;
                            if (callback != null)
                            {
                                callback.Invoke();
                            }
                        });
                    }
                    this._isSynching = false;
                    // ISSUE: reference to a compiler-generated field
                    if (callback == null)
                    {
                        return;
                    }
                    // ISSUE: reference to a compiler-generated field
                    callback.Invoke();
                }
            }
        }
예제 #5
0
 private static async Task StoreContactsAsync(ContactsCache contactsCache)
 {
     await CacheManager.TrySerializeAsync((IBinarySerializable)contactsCache, "SAVED_ContactsPhoneNumbers", false, CacheManager.DataType.CachedData);
 }
예제 #6
0
            void IAsyncStateMachine.MoveNext()
            {
                int num1 = this._1__state;

                try
                {
                    TaskAwaiter <List <string> > awaiter1;

                    TaskAwaiter <ContactsCache> awaiter2;
                    if (num1 != 0)
                    {
                        if (num1 != 1)
                        {
                            this._8__1          = new ContactsSyncManager.c__DisplayClass9_0();
                            this._8__1._4__this = this._4__this;
                            this._8__1.callback = this.callback;
                            if (!AppGlobalStateManager.Current.GlobalState.AllowSendContacts || this._4__this._isSynching)
                            {
                                if (this._8__1.callback != null)
                                {
                                    this._8__1.callback();
                                    goto label_21;
                                }
                                else
                                {
                                    goto label_21;
                                }
                            }
                            else
                            {
                                this._4__this._isSynching = true;
                                this._7__wrap1            = this._8__1;
                                List <string> stringList = this._7__wrap1.phoneNumbers;
                                awaiter1 = ContactsSyncManager.GetPhoneContactsAsync().GetAwaiter();
                                if (!awaiter1.IsCompleted)
                                {
                                    this._1__state = 0;
                                    this.u__1      = awaiter1;
                                    this.t__builder.AwaitUnsafeOnCompleted <TaskAwaiter <List <string> >, ContactsSyncManager.d__9>(ref awaiter1, ref this);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            awaiter2       = this.u__2;
                            this.u__2      = new TaskAwaiter <ContactsCache>();
                            this._1__state = -1;
                            goto label_16;
                        }
                    }
                    else
                    {
                        awaiter1       = this.u__1;
                        this.u__1      = new TaskAwaiter <List <string> >();
                        this._1__state = -1;
                    }
                    List <string> result1 = awaiter1.GetResult();
                    awaiter1 = new TaskAwaiter <List <string> >();
                    this._7__wrap1.phoneNumbers = result1;
                    this._7__wrap1 = null;
                    if (this._8__1.phoneNumbers == null)
                    {
                        if (this._8__1.callback != null)
                        {
                            this._8__1.callback();
                        }
                        this._4__this._isSynching = false;
                        goto label_21;
                    }
                    else
                    {
                        awaiter2 = ContactsSyncManager.RetrieveContactsAsync().GetAwaiter();
                        if (!awaiter2.IsCompleted)
                        {
                            this._1__state = 1;
                            this.u__2      = awaiter2;
                            this.t__builder.AwaitUnsafeOnCompleted <TaskAwaiter <ContactsCache>, ContactsSyncManager.d__9>(ref awaiter2, ref this);
                            return;
                        }
                    }
label_16:
                    ContactsCache result2 = awaiter2.GetResult();
                    awaiter2 = new TaskAwaiter <ContactsCache>();
                    if (!ContactsSyncManager.AreListsEqual(this._8__1.phoneNumbers, result2.PhoneNumbers))
                    {
                        AccountService.Instance.LookupContacts("phone", "", this._8__1.phoneNumbers, new Action <BackendResult <LookupContactsResponse, ResultCode> >(this._8__1.b__0));
                    }
                    this._4__this._isSynching = false;
                    if (this._8__1.callback != null)
                    {
                        this._8__1.callback();
                    }
                }
                catch (Exception ex)
                {
                    this._1__state = -2;
                    this.t__builder.SetException(ex);
                    return;
                }
label_21:
                this._1__state = -2;
                this.t__builder.SetResult();
            }