/// <summary>
        /// Private constructor for reading defaults from web.config.
        /// This constructor should only be invoked the first time the defaults are required.
        /// </summary>
        /// <param name="readDefaults">Indicates if defaults should be read or not.</param>
        private InterviewSettings(bool readDefaults)
        {
            // Read each of the four required settings.
            PostInterviewUrl    = ConfigurationManager.AppSettings["PostInterviewUrl"];          // "disposition" page
            InterviewRuntimeUrl = ConfigurationManager.AppSettings["InterviewRuntimeUrl"];       // formerly known as "JavaScriptUrl"; base Urls in host app to provide required files to browser interviews
            StyleSheetUrl       = ConfigurationManager.AppSettings["StyleSheetUrl"];
            InterviewFilesUrl   = ConfigurationManager.AppSettings["GetInterviewFileUrl"];

            ThemeName = ConfigurationManager.AppSettings["InterviewTheme"];

            // Urls in host app to support optional interview features
            DocumentPreviewUrl       = ConfigurationManager.AppSettings["DocumentPreviewUrl"];
            SaveAnswersUrl           = ConfigurationManager.AppSettings["SaveAnswersUrl"];
            AnswerFileDataServiceUrl = ConfigurationManager.AppSettings["AnswerFileDataService"];
            CustomDataSourcesSection customDataSourcesSection = ConfigurationManager.GetSection("customDataSources") as CustomDataSourcesSection;

            if (customDataSourcesSection != null)
            {
                CustomDataSources = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                foreach (DataSourceElement ds in customDataSourcesSection.DataSources)
                {
                    CustomDataSources[ds.Name] = ds.Address;
                }
            }

            // other settings having to do with the interview request or structure, rather than its user-observable behavior
            AddHdMainDiv           = Util.ReadConfigurationTristate("AddHdMainDiv", Tristate.True);
            RoundTripUnusedAnswers = Util.ReadConfigurationBoolean("RoundTripUnusedAnswers", true);

            // other interview settings
            Format = Util.ReadConfigurationEnum <InterviewFormat>("InterviewFormat", InterviewFormat.Unspecified);
            if (String.IsNullOrEmpty(ThemeName))
            {
                ThemeName = Util.ReadConfigurationString("ThemeName") ?? "hdsuser";
            }
            Title                  = Util.ReadConfigurationString("InterviewTitle");
            Locale                 = Util.ReadConfigurationString("InterviewLocale");
            NextFollowsOutline     = Util.ReadConfigurationTristate("NextFollowsOutline", Tristate.Default);
            ShowAllResourceButtons = Util.ReadConfigurationTristate("ShowAllResourceButtons", Tristate.Default);
            DisableDocumentPreview = Util.ReadConfigurationBoolean("DisableDocumentPreview", false);
            DisableSaveAnswers     = Util.ReadConfigurationBoolean("DisableSaveAnswers", false);
            DisableAnswerSummary   = Util.ReadConfigurationTristate("DisableAnswerSummary", Tristate.Default);
            AnswerSummary          = AnswerSummaryOptions.Default;

            // "shared" or "common" properties (these are also AssemblyOptions)
            DefaultUnansweredFormat  = Util.ReadConfigurationEnum <UnansweredFormat>("DefaultUnansweredFormat", UnansweredFormat.Default);
            HonorCmpUnansweredFormat = Util.ReadConfigurationTristate("HonorCmpUnansweredFormat", Tristate.Default);
            DefaultDateFormat        = ConfigurationManager.AppSettings["DefaultDateFormat"];
        }
Example #2
0
        /// <summary>
        /// Private constructor for reading defaults from web.config.
        /// This constructor should only be invoked the first time the defaults are required.
        /// </summary>
        /// <param name="readDefaults">Indicates if the default settings should be read or not.</param>
        private AssembleDocumentSettings(bool readDefaults)
        {
            _settings = new Dictionary <string, string>();

            Format        = DocumentType.Native;
            OutputOptions = null;

            RetainTransientAnswers = Util.ReadConfigurationBoolean("RetainTransientAnswers", false);
            UseMarkupSyntax        = Util.ReadConfigurationTristate("UseMarkupSyntax", Tristate.Default);

            // "shared" or "common" properties (these are also InterviewSettings)
            DefaultUnansweredFormat  = Util.ReadConfigurationEnum <UnansweredFormat>("DefaultUnansweredFormat", UnansweredFormat.Default);
            HonorCmpUnansweredFormat = Util.ReadConfigurationTristate("HonorCmpUnansweredFormat", Tristate.Default);
            DateOrderPreference      = Util.ReadConfigurationEnum <DateOrder>("DateOrder", DateOrder.Default);
            DefaultDateFormat        = ConfigurationManager.AppSettings["DefaultDateFormat"];
        }