Exemple #1
0
        private async Task EnsureProvisioned(ContactStore store)
        {
            if (AppGlobalStateManager.Current.LoggedInUserId != 0L)
            {
                bool   flag = true;
                string text = ContactsManager.GetRemoteId(AppGlobalStateManager.Current.GlobalState.LoggedInUser);
                try
                {
                    if (await store.FindContactByRemoteIdAsync(text) == null)
                    {
                        flag = false;
                    }
                }
                catch (Exception)
                {
                    flag = false;
                }
                if (!flag)
                {
                    try
                    {
                        StoredContact arg_159_0 = await store.CreateMeContactAsync(text);

                        arg_159_0.DisplayName = (AppGlobalStateManager.Current.GlobalState.LoggedInUser.Name);
                        await arg_159_0.SaveAsync();
                    }
                    catch
                    {
                    }
                    try
                    {
                        await SocialManager.ProvisionAsync();
                    }
                    catch
                    {
                    }
                }
                text = null;
            }
        }
        private async Task EnsureProvisioned(ContactStore store)
        {
            if (AppGlobalStateManager.Current.LoggedInUserId == 0L)
            {
                return;
            }
            bool   ok         = true;
            string meRemoteId = ContactsManager.GetRemoteId(AppGlobalStateManager.Current.GlobalState.LoggedInUser);

            try
            {
                if (await store.FindContactByRemoteIdAsync(meRemoteId) == null)
                {
                    ok = false;
                }
            }
            catch
            {
                ok = false;
            }
            if (!ok)
            {
                StoredContact meContactAsync = await store.CreateMeContactAsync(meRemoteId);

                string name = AppGlobalStateManager.Current.GlobalState.LoggedInUser.Name;
                meContactAsync.DisplayName = name;
                await meContactAsync.SaveAsync();

                try
                {
                    await SocialManager.ProvisionAsync();
                }
                catch
                {
                }
            }
            meRemoteId = null;
        }