Pokušavam da napravim button koji će, uz autentifikaciju, uraditi nešto kao master reset - pre svega clear listview i izbrisati sve iz XML file-a - kao da se program prvi put pali. Svi moji pokušaji završili su neslavno, pa sam ostao zaglavljen ovde:
Code (csharp):
private void button1_Click(object sender, EventArgs e)
{
if (txtUsername.Text == Properties.Settings.Default.MyUsername && txtPassword.Text == Properties.Settings.Default.MyPassword)
{
listView.Clear;
// ???????????
}
else
{
DialogResult dialogResult = MessageBox.Show("Wrong password! Do you want to try again?", "Warning", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Retry)
{
return;
}
else if (dialogResult == DialogResult.Cancel)
{
this.Close();
}
}
}
private void button1_Click(object sender, EventArgs e)
{
if (txtUsername.Text == Properties.Settings.Default.MyUsername && txtPassword.Text == Properties.Settings.Default.MyPassword)
{
listView.Clear;
// ???????????
}
else
{
DialogResult dialogResult = MessageBox.Show("Wrong password! Do you want to try again?", "Warning", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
if (dialogResult == DialogResult.Retry)
{
return;
}
else if (dialogResult == DialogResult.Cancel)
{
this.Close();
}
}
}
Ima li neko ideju?