WFA_psychometric_chart.Form1_main.timer1_Tick_For_Device C# (CSharp) Method

timer1_Tick_For_Device() public method

public timer1_Tick_For_Device ( object sender, EventArgs e ) : void
sender object
e EventArgs
return void
        public void timer1_Tick_For_Device(object sender, EventArgs e)
        {

            try
            {
                //    if (InvokeRequired)
                //    {
                //        //this.Invoke(new Action(() => RefreshDataFromDeviceAndWeb()));
                //        this.Invoke(new Action(() => AsyncMethod1ForPullingData()));
                //        return;
                //    }
                //    else
                //    {
                //        AsyncMethod1ForPullingData();
                //    }

                //--Now lets do the same task with background worker
                //if (!bgWorker.IsBusy)
                //{
                //   // MessageBox.Show("background worker calling");
                //    bgWorker.RunWorkerAsync();//--Running the worker async

                //}

               // MessageBox.Show("Entered form timer");
                if (FlagForCntdBG_Update == 0)
                {
                    //Means the edit/OFFLINE mode is ON then return 
                  //  MessageBox.Show("Entered FlagForCntdBG_Update=0");
                   // chart1.Enabled = true;
                    return;
                }
                else {
                   // chart1.Enabled = false;
                    //MessageBox.Show("Entered just else ");
                    if (!backgroundWorker1.IsBusy)
                    {
                       //chart1.Enabled = true;
                      //  MessageBox.Show("Entered FlagForCntdBG_Update=1");
                        // MessageBox.Show("background worker calling");
                        backgroundWorker1.RunWorkerAsync();//--Running the worker async
                       // chart1.Enabled = false;

                    }


                }



            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


        }
Form1_main