Confirm to delete
This commit is contained in:
parent
1d342897ab
commit
d64348ca5f
|
@ -151,15 +151,25 @@ namespace RDP_Portal {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonDelete_Click(object sender, EventArgs e) {
|
private void buttonDelete_Click(object sender, EventArgs e) {
|
||||||
|
// show confirm dialog
|
||||||
|
var confirmResult = MessageBox.Show(
|
||||||
|
"Are you sure to delete this profile?",
|
||||||
|
"Confirm",
|
||||||
|
MessageBoxButtons.YesNo);
|
||||||
|
|
||||||
|
// if confirm delete
|
||||||
|
if (confirmResult == DialogResult.Yes) {
|
||||||
var selectedItems = (Profile) listBox.SelectedItem;
|
var selectedItems = (Profile) listBox.SelectedItem;
|
||||||
selectedItems.Delete();
|
selectedItems.Delete();
|
||||||
_config.Profiles.Remove(selectedItems);
|
_config.Profiles.Remove(selectedItems);
|
||||||
_config.Save();
|
_config.Save();
|
||||||
|
|
||||||
if (_config.Profiles.Count == 0) {
|
if (_config.Profiles.Count == 0) {
|
||||||
AddNewProfile();
|
AddNewProfile();
|
||||||
SelectProfile(true);
|
SelectProfile(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void buttonSave_Click(object sender, EventArgs e) {
|
private void buttonSave_Click(object sender, EventArgs e) {
|
||||||
var profile = (Profile) listBox.SelectedItem;
|
var profile = (Profile) listBox.SelectedItem;
|
||||||
|
|
Loading…
Reference in New Issue