예제 #1
0
 public Form1()
 {
     InitializeComponent();
     hozzaad             = new ButtonClass();
     sutinev             = new TextBoxClass();
     isCukormentes       = new CheckBoxClass();
     hozzaad.MouseClick += AddToData;
     this.flowLayoutPanel1.Controls.Add(sutinev);
     this.flowLayoutPanel1.Controls.Add(isCukormentes);
     this.flowLayoutPanel1.Controls.Add(hozzaad);
 }
        public UserEditViewModel(User user, IList <ShopCard> shopCards, IList <SkillCard> skillCards, IList <ClassEquipmentCard> classEquipmentCards, IList <FamiliarCard> familiarCards)
        {
            if (user != null)
            {
                Id   = user.Id;
                Name = user.Name;
            }


            if (user.Character != null)
            {
                CharacterName = user.Character.Name;
            }

            ShopCards           = new List <CheckBoxClass>();
            SkillCards          = new List <CheckBoxClass>();
            ClassEquipmentCards = new List <CheckBoxClass>();
            FamiliarCards       = new List <CheckBoxClass>();

            foreach (var shopCard in shopCards)
            {
                var checkBox = new CheckBoxClass {
                    DisplayName = shopCard.Name
                };

                if (user.HasShopCard(shopCard))
                {
                    checkBox.Selected = true;
                }

                ShopCards.Add(checkBox);
            }

            foreach (var skillCard in skillCards)
            {
                var checkBox = new CheckBoxClass {
                    DisplayName = skillCard.Name
                };

                if (user.HasSkillCard(skillCard))
                {
                    checkBox.Selected = true;
                }

                SkillCards.Add(checkBox);
            }

            foreach (var classEquipmentCard in classEquipmentCards)
            {
                var checkBox = new CheckBoxClass {
                    DisplayName = classEquipmentCard.Name
                };

                if (user.HasClassEquipmentCard(classEquipmentCard))
                {
                    checkBox.Selected = true;
                }

                ClassEquipmentCards.Add(checkBox);
            }

            foreach (var familiarCard in familiarCards)
            {
                var checkBox = new CheckBoxClass {
                    DisplayName = familiarCard.Name
                };

                if (user.HasFamiliarCard(familiarCard))
                {
                    checkBox.Selected = true;
                }

                FamiliarCards.Add(checkBox);
            }
        }