/// <summary> /// Show a message for approval and return result. /// </summary> /// <param name="message"></param> /// <param name="silent"></param> /// <returns>True if approved, false otherwise.</returns> private async Task <bool> ApproveMessage(string message, bool silent) { if (!silent && MessageDlg != null) { MessageDlg.Message(message, true); return(await MessageDlg.ShowAsync().ConfigureAwait(false)); } else { Utils.LogError(message); return(false); } }
/// <summary> /// Show a message for approval and return result. /// </summary> /// <param name="message"></param> /// <param name="silent"></param> /// <returns>True if approved, false otherwise.</returns> private static async Task <bool> ApproveMessage(string message, bool silent) { if (!silent && MessageDlg != null) { MessageDlg.Message(message, true); return(await MessageDlg.ShowAsync()); } else { Utils.Trace(message); return(false); } }
/// <summary> /// Loads the configuration. /// </summary> public async Task <ApplicationConfiguration> LoadAppConfig( bool silent, Stream stream, ApplicationType applicationType, Type configurationType, bool applyTraceSettings, ICertificatePasswordProvider certificatePasswordProvider = null) { Utils.LogInfo("Loading application from stream."); try { // load the configuration file. ApplicationConfiguration configuration = await ApplicationConfiguration.Load( stream, applicationType, configurationType, applyTraceSettings, certificatePasswordProvider) .ConfigureAwait(false); if (configuration == null) { return(null); } return(configuration); } catch (Exception e) { Utils.LogError(e, "Could not load configuration from stream."); // warn user. if (!silent) { if (MessageDlg != null) { MessageDlg.Message("Load Application Configuration: " + e.Message); await MessageDlg.ShowAsync().ConfigureAwait(false); } throw; } return(null); } }
/// <summary> /// Loads the configuration. /// </summary> public static async Task <ApplicationConfiguration> LoadAppConfig( bool silent, string filePath, ApplicationType applicationType, Type configurationType, bool applyTraceSettings, ICertificatePasswordProvider certificatePasswordProvider = null) { Utils.Trace(Utils.TraceMasks.Information, "Loading application configuration file. {0}", filePath); try { // load the configuration file. ApplicationConfiguration configuration = await ApplicationConfiguration.Load( new System.IO.FileInfo(filePath), applicationType, configurationType, applyTraceSettings, certificatePasswordProvider) .ConfigureAwait(false); if (configuration == null) { return(null); } return(configuration); } catch (Exception e) { Utils.Trace(e, "Could not load configuration file. {0}", filePath); // warn user. if (!silent) { if (MessageDlg != null) { MessageDlg.Message("Load Application Configuration: " + e.Message); await MessageDlg.ShowAsync().ConfigureAwait(false); } throw; } return(null); } }