private void SyncLocalDB_DoWork(object sender, DoWorkEventArgs e)
 {
     try
     {
         while (!SyncLocalDB.CancellationPending)
         {
             SyncLocalDBRepository repo = new SyncLocalDBRepository();
             DataSet ds = GetFavorites();
             SyncLocalDB.ReportProgress(0, ds);
             repo.SyncCountry();
             repo.SyncVendorType();
             repo.SyncVendorMaster();
             repo.SyncLocation();
             repo.SyncRigType();
             Thread.Sleep(500);
         }
         e.Cancel = true;
         //SyncLocalDBRepository repo = new SyncLocalDBRepository();
         //repo.SyncCountry();
         //repo.SyncVendorType();
         //repo.SyncVendorMaster();
         //Thread.Sleep(1000);
     }
     catch (Exception ex)
     {
         SyncLocalDB.CancelAsync();
         MessageBox.Show("Syncing of Local DB failed. Error:" + ex.Message);
     }
 }
        private void HomePage_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'rSSDataSet.Resources' table. You can move, or remove it, as needed.
            this.resourcesTableAdapter.Fill(this.rSSDataSet.Resources);
            // TODO: This line of code loads data into the 'rSSDataSet.Appointments' table. You can move, or remove it, as needed.
            this.appointmentsTableAdapter.Fill(this.rSSDataSet.Appointments);
            this.Text = this.Text + " - " + Program.FinancialYearName;
            toolStripStatusLabel.Text = "User - " + Program.UserName;

            SyncLocalDB.RunWorkerAsync();
        }