C# Microsoft Azure Xamarin应用程序-从登录屏幕切换到忘记密码屏幕

C# Microsoft Azure Xamarin应用程序-从登录屏幕切换到忘记密码屏幕,c#,ios,azure,C#,Ios,Azure,我有以下代码的问题。登录视图显示为模式视图,当用户单击忘记密码时,它捕获错误并尝试显示另一个模式视图。问题是,第一种模式尚未清除。我看不出有什么方法可以告诉它只在第一个视图完成后调用第二个视图。有人能帮我吗 try { var platformParameters = UIApplication.SharedApplication.KeyWindow.RootViewController; AppDelegate.AuthenticationClien

我有以下代码的问题。登录视图显示为模式视图,当用户单击忘记密码时,它捕获错误并尝试显示另一个模式视图。问题是,第一种模式尚未清除。我看不出有什么方法可以告诉它只在第一个视图完成后调用第二个视图。有人能帮我吗

try
      {
        var platformParameters = UIApplication.SharedApplication.KeyWindow.RootViewController;
        AppDelegate.AuthenticationClient.PlatformParameters = new PlatformParameters(platformParameters);
        var authenticationResult = await AppDelegate.AuthenticationClient.AcquireTokenAsync(AppDelegate.Scopes, "", UiOptions.SelectAccount, string.Empty, null, AppDelegate.Authority, AppDelegate.SignUpSignInPolicy);

      }
      catch (Exception ex)
      {
        if (ex.Message != null && ex.Message.Contains("AADB2C90118"))
        {
          await OnForgotPassword();
        }
        else { 
          Console.WriteLine("Exception message: " + ex.Message);
        }

      }
 }

 private async Task OnForgotPassword()
    {
      try
      {
       var result = await AppDelegate.AuthenticationClient.AcquireTokenAsync(
          AppDelegate.Scopes,
          string.Empty,
          UiOptions.SelectAccount,
          string.Empty,
          null,
          AppDelegate.Authority,
          AppDelegate.PasswordResetPolicy);
      }
      catch (MsalException)
      {

      }

    }