public async Task DellIdent(string ident)
 {
     // Loading settings
     Configurations.LoadingConfig = new LoadingConfig
     {
         IndicatorColor = (Color)Application.Current.Resources["MainColor"],
         OverlayColor   = Color.Black,
         Opacity        = 0.8,
         DefaultMessage = AppResources.DeletingIdent,
     };
     RestClientMP server = new RestClientMP();
     await Loading.Instance.StartAsync(async progress =>
     {
         // some heavy process.
         await DellIdentTask(ident, server);
     });
 }
        private async Task DellIdentTask(string ident, RestClientMP server)
        {
            CommonResult result = await server.DellIdent(ident);

            if (result.Error == null)
            {
                // Settings.EventBlockData = await server.GetEventBlockData();
                ItemsList <NamedValue> resultN = await server.GetRequestsTypes();

                Settings.TypeApp = resultN.Data;
                /*viewModel.*/
                RemoveAccount.Execute(ident); //removeLs(ident);


                Device.BeginInvokeOnMainThread(async() =>
                {
                    IsRefreshing = true;

                    await RefreshPaysData();

                    IsRefreshing = false;
                });

                MessagingCenter.Send <Object, AccountInfo>(this, "RemoveIdent", Settings.Person.Accounts.Where(x => x.Ident == ident).FirstOrDefault());
            }
            else
            {
                await DisplayAlert(AppResources.ErrorTitle, result.Error, "ОК");
            }

            //Device.BeginInvokeOnMainThread(async () =>
            //{
            //    IsRefreshing = true;

            //    await RefreshPaysData();

            //    IsRefreshing = false;
            //});
        }
 public EnterCodeDialogViewModel(string id, EnterCodeDialogView view)
 {
     this.requestID = id;
     Server         = new RestClientMP();
     dialog         = view;
     SendCode       = new Command <string>(async(code) =>
     {
         if (code != null)
         {
             try
             {
                 var success = await Server.SendCodeRequestForpaidService(new PaidRequestCodeModel {
                     RequestId = this.requestID, Code = code
                 });
                 if (success)
                 {
                     dialog.CloseDialog();
                     MessagingCenter.Send <Object>(this, "ChangeThemeConst");
                     DependencyService.Get <IMessage>().ShortAlert(AppResources.EnterCodeSuccess);
                 }
                 else
                 {
                     DependencyService.Get <IMessage>().ShortAlert(AppResources.EnterCodeWrongCode);
                 }
             }
             catch (Exception e)
             {
                 throw e;
             }
         }
         else
         {
             DependencyService.Get <IMessage>().ShortAlert(AppResources.EnterCodeNoCode);
         }
     });
 }