private static void AddAsync(int progid)
{
lock (DbUpdateLock)
{
using (SQLiteCommand command = new SQLiteCommand("insert into favourites (progid) values (@progid)", FetchDbConn()))
{
command.Parameters.Add(new SQLiteParameter("@progid", progid));
try
{
command.ExecuteNonQuery();
}
catch (SQLiteException sqliteExp)
{
if (sqliteExp.ErrorCode == SQLiteErrorCode.Constraint)
{
// Already added while this was waiting in the threadpool
return;
}
throw;
}
}
}
if (Added != null)
{
Added(progid);
}
RaiseUpdated(progid);
}