Пример #1
0
 public void DeleteCharacter(CharacterClass chrDel, frmListCharacters FLC)
 {
     bool Found = false;
     if (chrDel != null)
     {
         foreach (CharacterClass CC in CBC[0].Characters)
         {
             if (!Found)
             {
                 if (CC == chrDel)
                     Found = true;
             }
         }
     }
     if (Found)
     {
         CBC[0].Characters.Remove(chrDel);
         MessageBox.Show("Character has been deleted.", "Success");
     }
     else
         MessageBox.Show("Couldn't delete character.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     FLC.PopulateCharacters(CBC[0].Characters);
     blDataSaved = false;
     CheckStatus();
 }
Пример #2
0
        private void listToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (CBC[0].Characters.Count > 0)
            {
                this.Enabled = false;
                frmListCharacters F = new frmListCharacters();
                F.Show();
                F.MainForm = this;

                F.PopulateCharacters(CBC[0].Characters);
            }
            else
            {
                MessageBox.Show("There are no characters. Please add characters so you can list them.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #3
0
        public void EditCharacter(CharacterClass chrOld, CharacterClass chrUpdate, Image Picture, frmListCharacters FLC)
        {
            bool Found = false;
            if (chrOld != null)
            {
                foreach (CharacterClass CC in CBC[0].Characters)
                {
                    if (!Found)
                    {
                        if (CC.Name == chrOld.Name)
                        {
                            CC.Name = chrUpdate.Name;
                            CC.Age = chrUpdate.Age;
                            CC.Race = chrUpdate.Race;
                            CC.Gender = chrUpdate.Gender;
                            CC.Occupation = chrUpdate.Occupation;
                            CC.Description = chrUpdate.Description;
                            CC.Hometown = chrUpdate.Hometown;
                            CC.SavePicture = ImageToString(Picture);
                            Found = true;
                            blDataSaved = false;
                        }
                    }
                }
            }
            if (Found)
                MessageBox.Show("Character edit successful!", "Editing...");
            else
                MessageBox.Show("Failed to edit character!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

        }