Example #1
0
        private TourOperator factoryRecognition()
        {
            TourOperator instance = null;

            foreach (Type mytype in Assembly.GetExecutingAssembly().GetTypes()
                     .Where(mytype => mytype.IsSubclassOf(typeof(TourOperator))))
            {
                instance = (TourOperator)Activator.CreateInstance(mytype);
                string propertyValue = instance.GetDescription();
                if (m_DescriptionValue == propertyValue)
                {
                    break;
                }
            }

            return(instance);
        }
Example #2
0
        private void addRadioButtons()
        {
            int buttonXStartPosition = 0;
            int buttonYStartPosition = 0;


            foreach (Type mytype in Assembly.GetExecutingAssembly().GetTypes()
                     .Where(mytype => mytype.IsSubclassOf(typeof(TourOperator))))
            {
                TourOperator instance    = (TourOperator)Activator.CreateInstance(mytype);
                RadioButton  radioButton = new RadioButton();
                radioButton.Location  = new Point(buttonXStartPosition, buttonYStartPosition);
                radioButton.Text      = instance.GetDescription();
                buttonYStartPosition += 20;

                panelRadioButtons.Controls.Add(radioButton);
                radioButton.CheckedChanged += radioButton_CheckedChanged;
            }
        }