コード例 #1
0
        private EExpander CreateExpander(CharacterEpisodes ep)
        {
            EExpander e = new EExpander(ep);

            e.OnAddBefore += AddBefore;
            e.OnRemove    += Remove;
            e.OnAddAfter  += OnAddAfter;
            return(e);;
        }
コード例 #2
0
        private void OnAddAfter(EExpander ex)
        {
            CharacterEpisodes nep = new CharacterEpisodes();

            nep.Title = "Episode";
            int index = Character.Info.IndexOf(ex.Episode);

            Character.Info.Insert(index + 1, nep);
            x_episodesHolder.Children.Insert(index + 1, CreateExpander(nep));
        }
コード例 #3
0
        private void AddBefore(EExpander ee)
        {
            CharacterEpisodes nep = new CharacterEpisodes();

            nep.Title = "Episode";
            int index = Character.Info.IndexOf(ee.Episode);

            Character.Info.Insert(index, nep);
            x_episodesHolder.Children.Insert(index, CreateExpander(nep));
        }
コード例 #4
0
        public CharacterContent CreateCharacter()
        {
            CharacterContent c = new CharacterContent();

            c.Id     = LastOne;
            c.Name   = "Anonymous";
            c.Father = DummyCharacter;
            c.Mother = DummyCharacter;
            CharacterEpisodes ep = new CharacterEpisodes();

            ep.Title   = "Life";
            ep.Content = "";
            c.Info.Add(ep);
            Characters.Add(c);
            LastOne++;
            return(c);
        }
コード例 #5
0
        private void LoadCharacters(XmlNode parent)
        {
            if (parent.HasChildNodes == false)
            {
                return;
            }
            List <ParentFind> parentFinds = new List <ParentFind>();

            Characters = new List <CharacterContent>();
            foreach (XmlNode node in parent.ChildNodes)
            {
                CharacterContent i          = new CharacterContent();
                ParentFind       parentFind = new ParentFind();
                parentFind.c = i;
                parentFinds.Add(parentFind);
                foreach (XmlAttribute att in node.Attributes)
                {
                    if (att.Name == XmlAttributeNames.Name)
                    {
                        i.Name = att.Value;
                    }
                    if (att.Name == XmlAttributeNames.Id)
                    {
                        Int32 id;
                        Int32.TryParse(att.Value, out id);
                        i.Id = id;
                    }
                }
                foreach (XmlNode n in node.ChildNodes)
                {
                    switch (n.Name)
                    {
                    case XmlNodeNames.Episode:
                    {
                        CharacterEpisodes ep = new CharacterEpisodes();
                        ep.Title   = n.Attributes.GetNamedItem(XmlAttributeNames.Name).Value;
                        ep.Content = n.InnerText;
                        i.Info.Add(ep);
                        break;
                    }

                    case XmlNodeNames.Father:
                    {
                        Int32.TryParse(n.InnerText, out parentFind.father);
                        break;
                    }

                    case XmlNodeNames.Mother:
                    {
                        Int32.TryParse(n.InnerText, out parentFind.mother);
                        break;
                    }

                    case XmlNodeNames.Status:
                    {
                        CharacterStatus s;
                        Enum.TryParse(n.InnerText, out s);
                        i.Status = s;
                        break;
                    }

                    case XmlNodeNames.Gender:
                    {
                        CharacterGender s;
                        Enum.TryParse(n.InnerText, out s);
                        i.Gender = s;
                        break;
                    }
                    }
                }
                Characters.Add(i);
            }
            foreach (ParentFind c in parentFinds)
            {
                c.c.Father = Characters.Find(delegate(CharacterContent bk)
                {
                    return(bk.Id == c.father);
                });
                if (c.c.Father == null)
                {
                    c.c.Father = DummyCharacter;
                }

                c.c.Mother = Characters.Find(delegate(CharacterContent bk)
                {
                    return(bk.Id == c.mother);
                });
                if (c.c.Mother == null)
                {
                    c.c.Mother = DummyCharacter;
                }
            }
            LastOne = Characters.Count;
        }
コード例 #6
0
 public EExpander(CharacterEpisodes ep)
 {
     Episode = ep;
     InitializeComponent();
 }