线程中show 窗口的有关问题

线程中show 窗口的问题


  while (ServerRun)
            {
                try
                {
                    using (HttpWebResponse response = HttpWeb.HttpWebResponseUtility.CreatePostHttpResponse(url, para2, cookie))
                    {
                        if (response != null && response.StatusCode == HttpStatusCode.OK)
                        {
                            string result = HttpWeb.HttpWebResponseUtility.GetData(response, Encoding.UTF8);
  AlertLib.AlertForm f = new AlertLib.AlertForm();
                                        f.Show(result , "提示", AlertLib.AlertForm.ShowWay.Fade, 300, 200, 200, 3000, 500);
                         
                        }                     
                    }
                }
                catch (System.Exception ex)
                {
                   
                }
                Thread.Sleep(10000);
                Application.DoEvents(); 
              
                //GC.Collect();
            }


现在碰到2个问题 
1. 窗口老是处于 未响应状态
2. show出来的窗口不能处于桌面的最顶端

请问怎么解决

------解决方案--------------------
不要在先线程中访问UI,用Invoke调用
http://www.microsoft.com/china/MSDN/library/enterprisedevelopment/softwaredev/misMultithreading.mspx?pf=true
  
*****************************************************************************
http://feiyun0112.cnblogs.com/
------解决方案--------------------
某个窗体或控件.Invoke(new Action(() => f.Show(result , "提示", AlertLib.AlertForm.ShowWay.Fade, 300, 200, 200, 3000, 500));
------解决方案--------------------

    /// <summary>
    /// 替代使用InvokeRequired
    /// </summary>
    static class ControlExtensions
    {
        public delegate void ActionShow();
        /// <summary>
        /// 从worker thread 调用UI Thread的控件的方法
        /// </summary>
        /// <param name="control"></param>
        /// <param name="code"></param>
        static public void UIThread(this Control control, ActionShow code)
        {
            if (control.InvokeRequired)
            {