Skip to content

Commit

Permalink
Added a prompt before clearing data (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Oct 3, 2020
1 parent 4cc6643 commit 2563f15
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion InternetTest/Classes/Branches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace InternetTest.Classes
{
public class Branches
{
string branch = "master";
string branch = "Version_Next";
// branch peut être égal à
// - master
// - Version_Next
Expand Down
42 changes: 28 additions & 14 deletions InternetTest/Forms/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,24 +207,38 @@ private void gunaWinSwitch2_CheckedChanged(object sender, EventArgs e)

private void gunaLinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Properties.Settings.Default.Reset();
Properties.Settings.Default.Save();
UpdateSite();
if (gunaComboBox1.Text.Contains("fr-FR"))
string promptBeforeRemove = "";

if (gunaComboBox1.Text.Contains("fr-FR")) // If the lang is french
{
gunaComboBox1.Text = "Français (fr-FR)";
gunaWinSwitch1.Checked = false;
gunaWinSwitch2.Checked = true;
MessageBox.Show("Les données ont été effacées.", "Terminé", MessageBoxButtons.OK, MessageBoxIcon.Information);
promptBeforeRemove = "Êtes-vous sûr de vouloir effacer toutes les données d'InternetTest ?";
}
else if (gunaComboBox1.Text.Contains("EN"))
else if (gunaComboBox1.Text.Contains("EN")) // If the lang is english
{
gunaComboBox1.Text = "French (fr-FR)";
gunaWinSwitch1.Checked = false;
gunaWinSwitch2.Checked = true;
MessageBox.Show("Data has been removed.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
promptBeforeRemove = "Are you sure you wanna erase all InternetTest's data?";
}

if (MessageBox.Show(promptBeforeRemove, "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Properties.Settings.Default.Reset();
Properties.Settings.Default.Save();
UpdateSite();
if (gunaComboBox1.Text.Contains("fr-FR"))
{
gunaComboBox1.Text = "Français (fr-FR)";
gunaWinSwitch1.Checked = false;
gunaWinSwitch2.Checked = true;
MessageBox.Show("Les données ont été effacées.", "Terminé", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else if (gunaComboBox1.Text.Contains("EN"))
{
gunaComboBox1.Text = "French (fr-FR)";
gunaWinSwitch1.Checked = false;
gunaWinSwitch2.Checked = true;
MessageBox.Show("Data has been removed.", "Done", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
gunaComboBox2.Text = Properties.Settings.Default.MapsProvider; // Mettre à jour le texte
}
gunaComboBox2.Text = Properties.Settings.Default.MapsProvider; // Mettre à jour le texte
}

private void gunaComboBox1_SelectedIndexChanged(object sender, EventArgs e)
Expand Down

0 comments on commit 2563f15

Please sign in to comment.