ACAT.Extensions.Default.UI.Dialogs.GeneralSettingsForm.getAppPreferencesFromUI C# (CSharp) Method

getAppPreferencesFromUI() private method

Gets the settings with the current state of widgets in the form and returns a ACATPreferences object that can be presisted.
private getAppPreferencesFromUI ( ) : ACATPreferences
return ACATPreferences
        private ACATPreferences getAppPreferencesFromUI()
        {
            var prefs = ACATPreferences.Load();

            var rootWidget = _dialogCommon.GetRootWidget();

            prefs.EnableGlass = Common.AppPreferences.EnableGlass = (rootWidget.Finder.FindChild(pbShowGlass.Name) as CheckBoxWidget).GetState();
            prefs.HideScannerOnIdle = Common.AppPreferences.HideScannerOnIdle = (rootWidget.Finder.FindChild(pbHideScannersOnIdle.Name) as CheckBoxWidget).GetState();
            prefs.ExpandAbbreviationsOnSeparator = Common.AppPreferences.ExpandAbbreviationsOnSeparator = (rootWidget.Finder.FindChild(pbExpandAbbreviationsOnSeparator.Name) as CheckBoxWidget).GetState();
            prefs.ShowTalkWindowOnStartup = Common.AppPreferences.ShowTalkWindowOnStartup = (rootWidget.Finder.FindChild(pbShowTalkWindowOnStartup.Name) as CheckBoxWidget).GetState();
            prefs.RetainTalkWindowContentsOnHide = Common.AppPreferences.RetainTalkWindowContentsOnHide = (rootWidget.Finder.FindChild(pbRetainTalkWindowText.Name) as CheckBoxWidget).GetState();
            prefs.DebugMessagesEnable = Common.AppPreferences.DebugMessagesEnable = (rootWidget.Finder.FindChild(pbEnableDebugTraceLogging.Name) as CheckBoxWidget).GetState();
            prefs.AuditLogEnable = Common.AppPreferences.AuditLogEnable = (rootWidget.Finder.FindChild(pbEnableAuditLog.Name) as CheckBoxWidget).GetState();
            prefs.AutoSaveScannerLastPosition = Common.AppPreferences.AutoSaveScannerLastPosition = (rootWidget.Finder.FindChild(pbScannerAutoSaveLastPosition.Name) as CheckBoxWidget).GetState();

            if (Common.AppPreferences.AutoSaveScannerLastPosition)
            {
                prefs.ScannerPosition = Common.AppPreferences.ScannerPosition = Context.AppWindowPosition;
            }

            prefs.DebugLogMessagesToFile = Common.AppPreferences.DebugLogMessagesToFile = Common.AppPreferences.DebugMessagesEnable;

            return prefs;
        }