Esempio n. 1
0
 protected override void OnInitialized()
 {
     Service.IsMakingRequest += (sender, evnt) =>
     {
         isLoading = evnt.IsLoading;
         DebugPrint.Log("IsMakingRequest: " + evnt.IsLoading.ToString());
     };
 }
Esempio n. 2
0
        //private RenderFragment ShowSpinner(bool yes)
        //{
        //    var icon = new RenderFragment((builder) => {
        //        builder.OpenComponent(1, typeof(Spinner));
        //        builder.AddAttribute(2,"Size", "24");
        //        builder.CloseComponent();

        //        });
        //    DebugPrint.Log("Show Spinner: " + yes.ToString());

        //    return yes ? icon : null;


        //}

        private async Task HandleValidSubmit()
        {
            DebugPrint.Log("HandleValidSubmit clicked");
            isLoading = true;
            StateHasChanged();
            // ShowSpinner(true);
            //await Task.Delay(2500);
            //ShowSpinner(false);
            //DebugPrint.Log("HandleValidSubmit Fim");
        }
Esempio n. 3
0
        async Task HandleRegister()
        {
            var apiResponse = await Service.Post <Command, ApiResponse <Result> >(registerCommand, "/api/authenticate/register");


            if (apiResponse.Succeeded)
            {
                DebugPrint.Log(apiResponse);
                await TokenService.StoreToken(new AppShared.Model.LocalUserInfo()
                {
                    Id          = apiResponse.Result.UserId,
                    AccessToken = apiResponse.Result.AccessToken
                });



                try
                {
                    var response = await DialogService.OpenAsync <SimpleConfirm>($"Your access is granted!",
                                                                                 new Dictionary <string, object>() { { "Description", new string[] {
                                                                                                                           //  $"The Id: {apiResponse.Result.UserId} is your identifier",
                                                                                                                           "You will need create your incidents. You will be redirected to your Profile page.",
                                                                                                                           "Keep your password safe!"
                                                                                                                       } } }
                                                                                 );

                    if ((bool)response)
                    {
                        Navigator.NavigateTo("/profile", forceLoad: true);
                    }
                    else
                    {
                        Navigator.NavigateTo("/", forceLoad: true);
                    }
                }
                catch (Exception ex)
                {
                    DebugPrint.Log("Error on HandleRegister.");
                    DebugPrint.Log($"HandleRegister:: [] \n{ex.Message}");

                    Console.WriteLine(ex.Message);
                }
                finally
                {
                    isLoading = false;
                }
            }
            else
            {
                var response = await DialogService.OpenAsync <SimpleConfirm>($"There was a problem!",
                                                                             new Dictionary <string, object>() { { "Description", apiResponse.Message.Split('\n').ToArray() } }
                                                                             );
            }
        }
Esempio n. 4
0
 public PreRequestTest()
 {
     DebugPrint.Log("PreRequest test iniciado");
 }