예제 #1
0
        private void btnFillCat_Click(object sender, EventArgs e)
        {
            Cat oCat = new Cat("Black", AnimalType.Cat, 25, "Tabby");

            oCats.Add(oCat);

            oCat = new Cat("White", AnimalType.Tiger, 125, "Fluffy");
            oCats.Add(oCat);

            dgvCat.AutoGenerateColumns = true;
            dgvCat.DataSource          = oCats;
        }
예제 #2
0
        void AddClick(object sender, EventArgs e)
        {
            switch (Selected)
            {
            case Page.Gen:
                break;

            case Page.Cats:
                CurrentCat.Add(new Category("New Category", true));
                break;

            case Page.Exts:
                if (ExtensionList.SelectedNode != null)
                {
                    Category Cat;
                    if (ExtensionList.SelectedNode.Level == 0)
                    {
                        Cat = CurrentCat.First(x => x.Name == ExtensionList.SelectedNode.Text);
                    }
                    else
                    {
                        Cat = CurrentCat.First(x => x.Name == ExtensionList.SelectedNode.Parent.Text);
                    }

                    if (Cat != null)
                    {
                        Cat.Extensions.Add(new Extension(Cat, "New Extension"));
                    }
                }
                break;
            }
            UpdateAll();
        }
예제 #3
0
 public void AppendCatItem(DocDto docDto)
 {
     if (_CatList == null)
     {
         _CatList = new ObservableCollection <DocDto>();
     }
     docDto.Parent = this;
     CatList.Add(docDto);
 }
        /// <summary>
        /// Returns a List of 5 Cats
        /// Random Names
        /// One from each cat breed
        /// </summary>
        /// <returns>CatList a List of Cat type objects</returns>
        public CatList MakeCats()
        {
            // If no cat names, load the list
            if (m_CatNames.Count == 0)
            {
                LoadNames();
            }

            CatList cats = new CatList();

            //int myCatBreedMemberCount = Enum.GetNames(typeof(CatBreed)).Length;
            //int myGenderTypeMemberCount = Enum.GetNames(typeof(GenderType)).Length;
            cats.Add(new Cat(m_CatNames[m_Random.Next(0, m_CatNames.Count)], CatBreed.Abyssinian, GenderType.Male, m_Random.Next(1, 18)));
            cats.Add(new Cat(m_CatNames[m_Random.Next(0, m_CatNames.Count)], CatBreed.American_Shorthair, GenderType.Female, m_Random.Next(1, 18)));
            cats.Add(new Cat(m_CatNames[m_Random.Next(0, m_CatNames.Count)], CatBreed.Bengal, GenderType.Male, m_Random.Next(1, 18)));
            cats.Add(new Cat(m_CatNames[m_Random.Next(0, m_CatNames.Count)], CatBreed.British_Longhair, GenderType.Female, m_Random.Next(1, 18)));
            cats.Add(new Cat(m_CatNames[m_Random.Next(0, m_CatNames.Count)], CatBreed.Maine_Coon, GenderType.Female, m_Random.Next(1, 18)));

            return(cats);
        } // end of method
예제 #5
0
        public CatList InitializeCatList()
        {
            CatList CL = new CatList();

            using (XmlTextReader Xread = new XmlTextReader("CatSettings.xml"))
            {
                while (Xread.Read())
                {
                    if (Xread.IsStartElement("Category"))
                    {
                        CL.Add(new Category(Xread.GetAttribute(0), bool.Parse(Xread.GetAttribute(1))));
                    }

                    else if (Xread.IsStartElement("Extension"))
                    {
                        CL[CL.Count - 1].Extensions.Add(new Extension(CL[CL.Count - 1], Xread.ReadString()));
                    }
                }
            }
            return(CL);
        }
예제 #6
0
 public CatList FxnsToList(CatExpr fxns)
 {
     CatList list = new CatList();                
     foreach (Function f in fxns )
     {
         if (f is PushFunction)
         {
             list.Add(FxnsToList(f.GetSubFxns()));
         }
         else if (f is DefinedFunction)
         {
             DefinedFunction def = f as DefinedFunction;
             if (f.GetSubFxns().Count > 0)
             {
                 foreach (Function g in f.GetSubFxns())
                     list.Add(g);
             }
             else
             {
                 list.Add(f);
             }
         }
         else
         {
             list.Add(f);
         }
     }
     return list;
 }