Exemplo n.º 1
0
        public void Do(TaskGroupSetting s)
        {
            if (this.curTaskGroup == null)
            {
                return;
            }

            if (!this.curTaskGroup.PrepareDo(this.showListView, s))
            {
                GlobalVar.Instance.logger.Error("准备执行任务失败.");
                return;
            }

            GlobalVar.Instance.logger.Info("开始执行任务.");
            StartPerformance();

            isProducerThreadRunning = true;
            isWorkerThreadRunning   = true;
            isNoticeStop            = false;

            STPStartInfo stpStartInfo = new STPStartInfo();

            stpStartInfo.ThreadPoolName   = "扎古量产池";
            stpStartInfo.IdleTimeout      = 5000;
            stpStartInfo.MaxWorkerThreads = s.ThreadNum;
            stpStartInfo.MinWorkerThreads = 0;
            stpStartInfo.EnableLocalPerformanceCounters = true;
            smartThreadPool = new SmartThreadPool(stpStartInfo);
            performance.Init(smartThreadPool);

            tasksProducerThread = new Thread(new ThreadStart(this.TasksProducerThreadMain));
            tasksProducerThread.IsBackground = true;
            tasksProducerThread.Start();
        }
Exemplo n.º 2
0
 public void HardCopy(TaskGroupSetting other)
 {
     this.ThreadNum      = other.ThreadNum;
     this.IntervalTimeMS = other.IntervalTimeMS;
     this.UAType         = other.UAType;
     this.IsAutoExport   = other.IsAutoExport;
     this.ExportType     = other.ExportType;
 }
Exemplo n.º 3
0
 private bool initPublicSetting(TaskGroupSetting s)
 {
     if (globalSetting == null)
     {
         globalSetting = new TaskGroupSetting();
     }
     globalSetting.HardCopy(s);
     return(true);
 }
Exemplo n.º 4
0
        private void materialRaisedButton_DoOrStop_Click(object sender, EventArgs e)
        {
            if (!GlobalVar.Instance.taskGroupManager.IsAnyTaskActiving())
            {
                SetTip("当前没有活跃任务.");
                return;
            }
            if (materialRaisedButton_DoOrStop.Text == "停止")
            {
                if (!GlobalVar.Instance.taskGroupManager.Stop())
                {
                    SetTip("停止任务失败,请重置...");
                }
                else
                {
                    SetTip("任务已停止.");
                }
                materialRaisedButton_DoOrStop.Text    = "执行";
                materialRaisedButton_DoOrStop.Visible = false;
                materialRaisedButton_Save.Visible     = true;
                if (materialCheckBox_AutoSaveResult.Checked)
                {
                    materialRaisedButton_Save_Click(null, null);
                }
            }
            else if (materialRaisedButton_DoOrStop.Text == "执行")
            {
                TaskGroupSetting s = new TaskGroupSetting();
                s.IntervalTimeMS = GlobalVar.Instance.config.IntevalTime;
                s.ThreadNum      = GlobalVar.Instance.config.ThreadNum;
                s.UAType         = GlobalVar.Instance.config.UAType;
                s.IsAutoExport   = materialCheckBox_AutoSaveResult.Checked;
                if (materialRadioButton_txt.Checked)
                {
                    s.ExportType = ResourceType.eResourceType_Txt;
                }
                if (materialRadioButton_csv.Checked)
                {
                    s.ExportType = ResourceType.eResourceType_Csv;
                }
                if (materialRadioButton_mysql.Checked)
                {
                    s.ExportType = ResourceType.eResourceType_MySQL;
                }

                GlobalVar.Instance.taskGroupManager.Do(s);

                SetTip("开始执行任务.");
                materialRaisedButton_DoOrStop.Text = "停止";
            }
            else
            {
                return;
            }
        }
Exemplo n.º 5
0
        public override bool PrepareDo(Control listView, TaskGroupSetting s)
        {
            if (listView == null || !(listView is FastObjectListView))
            {
                return(false);
            }
            if (this.uiPanel == null || !(uiPanel is TaskGroup_FileCheck_Form))
            {
                return(false);
            }
            this.taskGroupStatus = TaskGroupStatus.eTaskGroupStatus_Doing;
            initPrivateSetting();
            initPublicSetting(s);
            initListView(listView);

            return(true);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 开始准备【点击 执行 按钮时触发】
 /// </summary>
 /// <param name="listView"></param>
 /// <param name="s"></param>
 /// <returns></returns>
 public abstract bool PrepareDo(Control listView, TaskGroupSetting s);