首页 > 代码库 > BaseWorkerForm
BaseWorkerForm
using System.Collections.Generic;using System.Windows.Forms;using WindowsFormsApplication3.Enums;using WindowsFormsApplication3.Jobs;using WindowsFormsApplication3.Model;using WindowsFormsApplication3.DataStorge;namespace WindowsFormsApplication3.FormPage{ public class BaseWorkerForm : Form { public delegate void FormStatusChangedHandler(); public event FormStatusChangedHandler FormStatusChanged; protected int childFormNO; public int ChildFormNO{ get{return childFormNO;}} protected CheckoutContext checkoutContext; protected List<BaseJob> jobs; protected FormStatus status; public virtual FormStatus Status { get { return status; } } public BaseWorkerForm():this(new CheckoutContext(),CheckoutStep.Introduction){} public BaseWorkerForm(CheckoutContext checkoutContext,CheckoutStep checkoutStep):base() { this.checkoutContext= checkoutContext; jobs=new List<BaseJob>(); } public virtual void Execute() { status = FormStatus.Processing; ReportChildFormNO(); ReportFormStatusChanged(); } public void ReportFormStatusChanged(){ if(FormStatusChanged!=null) FormStatusChanged(); } public virtual void RefreshForm() { } public virtual void ResetForm() { jobs.Clear(); status = FormStatus.Waiting; ReportFormStatusChanged(); } public void ReportChildFormNO() { childFormNO = 0; foreach (var childf in checkoutContext.formHierachy) { if (childf.fatherForm == base.Text) childFormNO++; } } public int FinishedChildFormNO(string formname) { int finishedFormNO = 0; foreach (var childf in checkoutContext.formHierachy) { if (childf.fatherForm == formname&&childf.childForm.status==FormStatus.OK) finishedFormNO++; } return finishedFormNO; } }}
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。