private void ButtonNew_Click(object sender, EventArgs e) { var newForm = new AddChangeAlias(aliasDictionary, "Create new alias item" + "\n\r" + "submit proper fields", true); if (newForm.ShowDialog(this) != DialogResult.OK) { return; } var dataBase = new SqliteDatabase(labelDB.Text); dataBase.AddNewItems(newForm.TextBoxAliasName, newForm.TextBoxPath); aliasDictionary.Add(newForm.TextBoxAliasName, newForm.TextBoxPath); RefreshAlias(); RefreshIp(); labelAliasInfo.Text = "New alias " + newForm.TextBoxAliasName + " created"; buttonChange.Enabled = false; buttonDelete.Enabled = false; }
private void ButtonAddIp_Click(object sender, EventArgs e) { var newForm = new InputIP("Add new IP"); if (newForm.ShowDialog(this) != DialogResult.OK) { return; } labelIP.Text = newForm.labelInputIp.Text; string newip = newForm.textBox1.Text + "." + newForm.textBox2.Text + "." + newForm.textBox3.Text + "." + newForm.textBox4.Text; if (ipList.Contains(newip)) { labelIP.Text = "This IP is alredy exist in list!"; return; } var dataBase = new SqliteDatabase(labelDB.Text); dataBase.AddNewItems(newip); ipList.Add(newip); RefreshIp(); labelIP.Text = "New IP " + newip + " was added!"; buttonDeleteIp.Enabled = false; }