I'm writing a program that can be used by multiple users and concurrency is a big concern of mine. I wrote the program and didn't even know about the subject, and now that I'm in multi-user testing, things are starting to blow up.
I want to be able to re-try the action if it fails, but don't know how. My code shows a message box if there is an error, but what I'd really like to do is have it wait for a second and trigger the Button.Click() event again.
How can I accomplish this?
Button.Click()
{
var Result =
from a in DB.Table
where a.Id == 1
select new {Row = a}.Single();
Result.Row.Value = "hulkSMASH!!!";
try
{
DB.SubmitChanges();
}
catch
{
MessageBox.Show("Action failed");
}
}