// Display details of the exception. 
 // We are doing this here to help you, as a developer, understand exactly
 // what exception was received. In a real app, you would
 // handle exceptions within your code and give a more user-friendly behavior.
 internal static void DisplayException(MissingConfigurationValueException exception) {
   var title = "Connected Services configuration failure";
   StringBuilder content = new StringBuilder();
   content.AppendLine("We were unable to connect to Office 365. Here's the exception we received:");
   content.AppendFormat("Exception: {0}\n\n", exception.Message);
   content.AppendLine("Suggestion: Make sure you have added the Connected Services to this project as outlined in the Readme file.");
   MessageDialogHelper.ShowDialogAsync(content.ToString(), title);
 }
        // Display details of the exception.
        // We are doing this here to help you, as a developer, understand exactly
        // what exception was received. In a real app, you would
        // handle exceptions within your code and give a more user-friendly behavior.
        internal static void DisplayException(MissingConfigurationValueException exception)
        {
            var           title   = "Connected Services configuration failure";
            StringBuilder content = new StringBuilder();

            content.AppendLine("We were unable to connect to Office 365. Here's the exception we received:");
            content.AppendFormat("Exception: {0}\n\n", exception.Message);
            content.AppendLine("Suggestion: Make sure you have added the Connected Services to this project as outlined in the Readme file.");
            MessageDialogHelper.ShowDialogAsync(content.ToString(), title);
        }
Example #3
0
 /// <summary>
 /// Checks that an access token is available.
 /// This method requires that the ServiceResourceId has been set previously.
 /// </summary>
 /// <returns>The access token.</returns>
 internal static async Task <string> EnsureAccessTokenAvailableAsync()
 {
     if (!String.IsNullOrEmpty(ServiceResourceId))
     {
         return(await EnsureAccessTokenAvailableAsync(ServiceResourceId));
     }
     else
     {
         MissingConfigurationValueException mcve =
             new MissingConfigurationValueException(
                 "To use this method you have to call EnsureAccessTokenAvailableAsync(string serviceResourceId) at least once."
                 );
         MessageDialogHelper.DisplayException(mcve);
         return(null);
     }
 }
 /// <summary>
 /// Checks that an access token is available.
 /// This method requires that the ServiceResourceId has been set previously.
 /// </summary>
 /// <returns>The access token.</returns>
 internal static async Task<string> EnsureAccessTokenAvailableAsync()
 {
     if(!String.IsNullOrEmpty(ServiceResourceId))
     {
         return await EnsureAccessTokenAvailableAsync(ServiceResourceId);
     }
     else
     {
         MissingConfigurationValueException mcve = 
             new MissingConfigurationValueException(
                 "To use this method you have to call EnsureAccessTokenAvailableAsync(string serviceResourceId) at least once."
                 );
         MessageDialogHelper.DisplayException(mcve);
         return null;
     }
 }