UI/_OnOptionsSourceInitialized.ps1

function _OnOptionsSourceInitialized {
    #region Entra ID
    $Options_EntraIDCheckBox.IsChecked = $STTSettings.FeatureSettings.Entra
    if ($Options_EntraIDCheckBox.IsChecked) {
        $Options_EntraTenantTextBox.IsEnabled = $true
        $Options_EntraConnectServerTextBox.IsEnabled = $true
    }
    else {
        $Options_EntraTenantTextBox.IsEnabled = $false
        $Options_EntraConnectServerTextBox.IsEnabled = $false
    }
    #endregion

    #region DC Settings
    $DCs = Get-ADDomainController @GetObjectSplat -Filter *
    foreach ($DC in $DCs) {
        $Options_DCComboBox.Items.Add($DC.Name)
    }
    $Options_DCComboBox.Text = $STTSettings.DCSettings.DomainController
    #endregion

    #region SCCM
    $Options_SCCMIntegrationCheckBox.IsChecked = $STTSettings.FeatureSettings.SCCM
    if ($Options_SCCMIntegrationCheckBox.IsChecked) {
        $Options_SCCMServerTextBox.IsEnabled = $true
        $Options_SCCMCollectionComboBox.IsEnabled = $true

        try {
            $SCCMCollections = _GetSCCMInformationQuerySTT -Route wmi -Connector 'SMS_Collection' | Sort-Object
        }
        catch {
            $Options_SavingTextBlock.Text = "Unable to get collections from SCCM. Verify that you have permissions to read SCCM."
        }
        if ($SCCMCollections) {
            foreach ($Collection in $($SCCMCollections | Sort-Object Name)) {
                $Options_SCCMCollectionComboBox.Items.Add($Collection.Name)
            }
            $Options_SCCMCollectionComboBox.SelectedItem = $STTSettings.SCCMSettings.SCCMDefaultCollection
        }
        else {
            $Options_SCCMCollectionComboBox.Text = 'Unable to load.'
        }
    }
    else {
        $Options_SCCMServerTextBox.IsEnabled = $false
        $Options_SCCMCollectionComboBox.IsEnabled = $false
    }
    #endregion

    #region Exchange on-premise
    $Options_ExchangeIntegrationCheckBox.IsChecked = $STTSettings.FeatureSettings.Exchange
    #endregion

    switch ($STTSettings.Theme) {
        'Dark' {
            $Options_DarkThemeRadioButton.IsChecked = $true
        }
        'Light' {
            $Options_LightThemeRadioButton.IsChecked = $true
        }
        'Violet'{
            $Options_VioletThemeRadioButton.IsChecked = $true
        }
        Default {}
    }

    #region Stored Objects
    $Options_ObjectCacheTextBox.Text = $STTSettings.ObjectsSettings.ObjectStorageFolder
    #endregion
}