Пример #1
0
        /// <summary>
        /// Sets the items to show on the list of choices base on the random sources installed
        /// on the system.
        /// </summary>
        private void SetListItems()
        {
            SettingDescriptionAttribute     attribute       = SettingsAttributeUtility.GetSettingsAttribute(typeof(RandomSourceSettings), "RngRandomSource");
            ListSettingDescriptionAttribute attributeAsList = attribute as ListSettingDescriptionAttribute;

            if (attributeAsList != null)
            {
                attributeAsList.Clear(typeof(RandomSourceSettings), "RngRandomSource");
                foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/RandomSourcesSupport/RandomSource"))
                {
                    IRandomSource randomSource = node.CreateInstance() as IRandomSource;
                    if (randomSource != null)
                    {
                        string description = randomSource is IDescription ? ((IDescription)randomSource).Description : randomSource.ToString();
                        attributeAsList.AddItem(typeof(RandomSourceSettings), "RngRandomSource", description);
                    }
                }
            }
        }