Example #1
0
        public static Pet MakeRandomPet()
        {
            List <string> names = new List <string>
            {
                "Loki",
                "Rex",
                "Tyson",
                "Bandit",
                "Max",
                "Tomo",
                "Perro",
                "Mimo",
                "Ginger"
            };
            string   randomName   = names[generator.Next(names.Count)];
            int      randomYear   = generator.Next(DateTime.Today.Year - 10, DateTime.Today.Year + 1);
            int      randomMonth  = generator.Next(1, DateTime.Today.Month + 1);
            int      randomDay    = generator.Next(1, DateTime.Today.Day + 1);
            DateTime randomDate   = new DateTime(randomYear, randomMonth, randomDay);
            decimal  randomWeight = ((decimal)generator.Next(100, 2001)) / 100;

            if (randomYear >= DateTime.Today.Year)
            {
                randomWeight /= 10;
            }
            BehaviourTypes randomBehaviour = (BehaviourTypes)generator.Next(2);
            EarTypes       randomEarType   = (EarTypes)generator.Next(2);

            return(new Dog(randomName, randomWeight, randomDate, randomBehaviour, randomEarType));
        }
Example #2
0
        /// <summary>
        /// Handles the click events for the buttons.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>This handler set the TypeOfEar property so we have
        /// it for the invoking editor and close this control. (Required
        /// functionality for dismissing DropDown</remarks>
        private void genericButton_Click(object sender, System.EventArgs e)
        {
            Button btn = (Button)sender;

            switch (btn.Name)
            {
            case "btnRegular":
                TypeOfEar = EarTypes.regular;
                break;

            case "btnOgee":
                TypeOfEar = EarTypes.ogee;
                break;

            case "btnConcave":
                TypeOfEar = EarTypes.concave;
                break;

            case "btnLine":
                TypeOfEar = EarTypes.line;
                break;

            case "btnRounded":
                TypeOfEar = EarTypes.rounded;
                break;

            case "btnStair":
                TypeOfEar = EarTypes.stair;
                break;

            case "btnSlant":
                TypeOfEar = EarTypes.slant;
                break;

            case "btnSquare":
                TypeOfEar = EarTypes.square;
                break;
            }

            editorService.CloseDropDown();
        }
Example #3
0
 public Dog(string name, decimal weight, DateTime birthDate, BehaviourTypes behaviour, EarTypes ear) : base(name, weight, birthDate)
 {
     Behaviour = behaviour;
     Ears      = ear;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EarAdornment"/> class.
 /// </summary>
 /// <param name="et">The et.</param>
 /// <param name="bnds">The BNDS.</param>
 public EarAdornment(EarTypes et, Rectangle bnds)
 {
     _earType   = et;
     _earBounds = bnds;
 }