Example #1
0
        private static void DoWork(object data)
        {
            RefreshThread refresher = (RefreshThread)data;

            try
            {
                List <Proxy> pList = refresher.proxyList;

                foreach (Proxy proxy in pList)
                {
                    refresher.Description = proxy.IpAndPort + "开始刷新...";
                    try
                    {
                        Refresh(refresher, proxy);
                        RefreshForm fm = (RefreshForm)Application.OpenForms["RefreshForm"];
                        if (null != fm)
                        {
                            fm.UpdateDataGrid();
                        }
                        Thread.Sleep(refresher.sleepTime * 1000);
                    }
                    catch (ThreadAbortException)
                    {
                    }
                    catch (Exception)
                    {
                    }
                    finally
                    {
                        refresher.TotalCount++;
                    }
                    refresher.Status = refresher.thread.ThreadState.ToString();
                }

                refresher.Status = "Completed";
            }
            catch (Exception ex)
            {
                // 线程被放弃
                refresher.Status = "Completed";
                Console.WriteLine(ex.Message);
                //WriteException(ex);
            }
            finally
            {
                refresher.OnCompleted();
            }
        }
Example #2
0
        /// <summary>
        /// 显示插件
        /// </summary>
        public void ShowPlugin()
        {
            try
            {
                if (null == refreshForm)
                {
                    refreshForm = new RefreshForm(app, this); //初始化插件窗体
                }

                refreshForm.Show(app.DockPanel, DockState.Document); //显示在停靠栏中间
            }
            catch (Exception ex)
            {
                //app.WriteDebug(ex); //代理公布器调试窗体信息显示
                app.WriteExceptionLog(ex);//记录错误日志
                //app.WriteLog(ex.Message);
            }
        }
Example #3
0
 /// <summary>
 /// 隐藏插件
 /// </summary>
 public void HidePlugin()
 {
     try
     {
         if (null != refreshForm)
         {
             if (this.Exist)
             {
                 refreshForm.Hide();
             }
             else
             {
                 refreshForm = null;
             }
         }
     }
     catch (Exception ex)
     {
         //app.WriteDebug(ex); //代理公布器调试窗体信息显示
         app.WriteExceptionLog(ex);//记录错误日志
         //app.WriteLog(ex.Message);
     }
 }