예제 #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBox8.Text) || string.IsNullOrWhiteSpace(textBox5.Text))
            {
                PopUp.ShowInfo("One or more TextBox is empty");
                return;
            }

            int level;

            if (!int.TryParse(textBox5.Text, out level))
            {
                PopUp.ShowInfo("Level has an invalid format");
            }

            KeyValuePair <string, int> keyValue = new KeyValuePair <string, int>(textBox8.Text, level);

            if (listBox2.Items.Contains(keyValue))
            {
                PopUp.ShowInfo("Skill is already in place");
            }

            textBox8.Clear();
            textBox5.Clear();
            listBox2.Items.Add(keyValue);
        }
예제 #2
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBox6.Text))
            {
                PopUp.ShowInfo("textbox is empty");
                return;
            }
            if (listBox3.Items.Contains(textBox6.Text))
            {
                PopUp.ShowInfo($"{textBox6.Text} is already added");
                return;
            }

            listBox3.Items.Add(textBox6.Text);
            textBox6.Clear();
        }