Ejemplo n.º 1
0
        public void AddExample(Unistroke p)
        {
            var success = true;

            try
            {
                // first, ensure that p's name is right
                var name = ParseName(p.Name);
                if (name != _name)
                {
                    throw new ArgumentException("Prototype name does not equal the name of the category to which it was added.");
                }

                // second, ensure that it doesn't already exist
                if (_prototypes.Any(p0 => p0.Name == p.Name))
                {
                    throw new ArgumentException("Prototype name was added more than once to its category.");
                }
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine(ex.Message);
                success = false;
            }
            if (success)
            {
                _prototypes.Add(p);
            }
        }
Ejemplo n.º 2
0
 public Category(string name, Unistroke firstExample)
 {
     _name = name;
     //_prototypes = new ArrayList();
     _prototypes = new List <Unistroke>();
     AddExample(firstExample);
 }