I am wondering what is the best way to achieve this in Windows Forms - what I need is a window showing time elapsed (1 sec 2 secs etc) up to 90 seconds while code is being executed. I have a timer right now implemented as follows but I think I also need a stopwatch there as well since the Timer blocks the main thread.
 static System.Timers.Timer pXRFTimer = new System.Timers.Timer();       
  static int _pXRFTimerCounter = 0;
   private void ScanpXRF()
        {
            _pXRFTimerCounter = 0;
            pXRFTimer.Enabled = true;
            pXRFTimer.Interval = 1000;
            pXRFTimer.Elapsed += new ElapsedEventHandler(pXRFTimer_Tick);
            pXRFTimer.Start();
            //START action to be measured here!
            DoSomethingToBeMeasured();
        }
        private static void pXRFTimer_Tick(Object sender, EventArgs e)
        {
            _pXRFTimerCounter++;
            if (_pXRFTimerCounter >= 90)
            {
                pXRFTimer.Stop();             
            }
            else
            {
                //show time elapsed
            }
        }
 
    