private async void RegisterUser()
        {
            try
            {
                //editMail.Text = "*****@*****.**";
                //editUsername.Text = "TESTuSER";
                //editPassword.Text = "Tafra123";
                using IAuthResult authResult = await FirebaseHandler.Instance.Auth
                                               .CreateUserWithEmailAndPasswordAsync(editMail.Text, editPassword.Text)
                                               .ConfigureAwait(false);

                using UserProfileChangeRequest profile = new UserProfileChangeRequest.Builder()
                                                         .SetDisplayName(editUsername.Text)
                                                         .Build();

                await authResult.User
                .UpdateProfileAsync(profile)
                .ConfigureAwait(false);

                UserProfile up = new UserProfile(editUsername.Text, editMail.Text);
                UserGroups  ug = new UserGroups()
                {
                    Creator = new User(up)
                };

                System.Collections.Generic.List <Task> tasks = Instance.InitFirestoreUser(editUsername.Text, editMail.Text);
                Task.WaitAll(tasks.ToArray());
                if (tasks.All(t => t.IsCompletedSuccessfully))
                {
                    Instance.LoadUserData(editUsername.Text);
                    StartActivity(typeof(MainActivity));
                    Finish();
                }
                else
                {
                    MainThread.BeginInvokeOnMainThread(() =>
                    {
                        Toast.MakeText(ApplicationContext, Resource.String.err_failed_to_save_firestore, ToastLength.Short)
                        .Show();
                    });
                }
            }
            catch (FirebaseException excepion)
            {
                MainThread.BeginInvokeOnMainThread(() =>
                {
                    Toast.MakeText(ApplicationContext, excepion.Message, ToastLength.Short)
                    .Show();
                });
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 信息总览
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var archives = new System.Collections.Generic.List<Yun.Item.GoodsDetail>();
            int i = 1;
                var d = YunClient.Instance.Execute(new Yun.Item.Request.GetItemsRequest { PageNum = i, PageSize = 40, NeedPromotion = true,Ids="18614,19367" }).Items;
                if (d != null && d.Any())
                {
                    i++;
                    foreach (var tt in d)
                    {
                        if (archives.All(e => tt.Id != e.Id))
                        {
                            archives.Add(tt);
                        }
                        else
                        {
                            throw new Exception();
                        }

                    }
                }
            var addItems = archives.ConvertAll(YunShop.Core.Model.Data.GoodsDetailInSql.ConvertGoodsInSql);
            return View(addItems);
        }