private async void verifica_permissao()
        {
            try
            {
                //var permissao = await Getpermissao();

                if (await ChecapermisaoService.checa_permissao())
                {
                }
                else
                {
                    var exemplo = Xamarin.Forms.DependencyService.Get <ICloseApplication>();
                    exemplo.closeApplication();
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            //   bool teste = await ChecapermisaoService.checa_permissao();
            //   return teste ;
        }
        private async void Login()
        {
            var testa = await ChecapermisaoService.checa_permissao();

            if (string.IsNullOrEmpty(Usuarioid))
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Prencha o campo Email!", "OK");

                mostra_mensagem = true;
                mensagem        = "Prencha o campo Email!";
                // await dialogServices.ShowMessage("Erro", "Prencha o campo Usuário!");
                return;
            }


            if (string.IsNullOrEmpty(Senha))
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Prencha o campo Senha!", "OK");

                return;
            }

            var response = new Response();

            IsRunning = true;
            var current = Connectivity.NetworkAccess;

            if (current == NetworkAccess.Internet)

            {
                response = await apiService.Login(Usuarioid, Senha);
            }
            else
            {
                await PageDialogService.DisplayAlertAsync("Erro", "Dispositivo sem Conexâo", "OK");

                //await dialogServices.ShowMessage("Erro", response.Message);
                IsRunning = false;
                return;
            }
            IsRunning = false;

            if (!response.IsSuccess)
            {
                await PageDialogService.DisplayAlertAsync("Erro", response.Message, "OK");

                //await dialogServices.ShowMessage("Erro", response.Message);
                return;
            }

            var User = (Dentista)response.Result;

            if (User.Id == 999999999)
            {
                User.tipo         = "Administrador";
                App.usuariologado = User;

                //Settings.Grava_Settings(JsonConvert.SerializeObject(User));
                Preferences.Set("dentistaserializado", JsonConvert.SerializeObject(User));
                //Preferences.Get("dentistaserializado", JsonConvert.SerializeObject(User));
                await NavigationService.NavigateAsync("/MasterPage/NavigationPage/DentistaPage");
            }
            else
            {
                User.tipo         = "Dentista";
                App.usuariologado = User;
                // Settings.Grava_Settings(JsonConvert.SerializeObject(User));
                Preferences.Set("dentistaserializado", JsonConvert.SerializeObject(User));
                //Preferences.Get("dentistaserializado", JsonConvert.SerializeObject(User));
                var navigationParams = new NavigationParameters();
                navigationParams.Add("paciente", User);
                await NavigationService.NavigateAsync("/MasterPage/NavigationPage/DentistaPage");

                //  await _navigationService.NavigateAsync("/MasterPage/NavigationPage/ExamesPage", navigationParams);
            }
            //grava usuario


            //

            //await _navigationService.NavigateAsync("MainPage");
            //navigationServices.SetMainPage(User);
        }