public static Int32 GetValueTS(this ProgressBar x) { if (x.InvokeRequired) { Int32 m_ret = 0; x.Invoke(new EventHandler(delegate(object o, EventArgs a) { m_ret = x.GetValueTS(); })); return(m_ret); } else { return(x.Value); } }