I have a web-application which have Android and iPhone application too with centralized database. On some event I have to perform some database operation from both web & web-services and send various SMS, email and push notification to both Android & iPhone application (At-least 10-15 at a time). All these process are taking too much time and user need to wait till all operation being completed. To overcome this issue I have implemented background process (for the first time), which also take same time, Please review below code and let me know is I am implementing background process correctly or there is some other method to do so..
private readonly BackgroundWorker worker = new BackgroundWorker();
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
try
{
FunctionToBePerformInBackground();
}
catch
{
}
}
void Page_Load(object sender, EventArgs e)
{
worker.DoWork += new DoWorkEventHandler(backgroundWorker1_DoWork);
}
protected void buton_click(object sender, EventArgs e)
{
worker.RunWorkerAsync();
}
Thanks In Advance..