private void UIOperator() { UIControlFunc(); UIUpdate(); void UIControlFunc() { this.btn_Add.Click += (s, e) => funcManager.Addfunc(userBLLV2.Running); this.btn_Delete.Click += (s, e) => { funcManager.Removefunc(userBLLV2.Running); funcManager.Removefunc(userBLL.Running); }; this.btn_Stop.Click += (s, e) => IFuncManager.TaskFlag = false; this.btn_Reset.Click += (s, e) => { if (IFuncManager.TaskFlag == true) { return; } IFuncManager.TaskFlag = true; funcManager.Run(); }; } void UIUpdate() { IFuncManager.TransAction = (transType, str) => { if (this.IsHandleCreated) { this.Invoke(new Action(() => { switch (transType) { case TransType.TopText: this.Text = str; break; case TransType.LabelText: this.label1.Text = str; break; } })); } }; } }
private void TaskRun() { funcManager = new UserBLLV2(); funcManager.Addfunc(userBLL.Running); funcManager.Run(); }