zoukankan      html  css  js  c++  java
  • 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;
            }
        }
    }
  • 相关阅读:
    “软件工程”课程评价
    我爱淘二次冲刺阶段4
    我爱淘二次冲刺阶段3
    我爱淘二次冲刺阶段2
    MVC框架具体使用
    初次见面- MVC
    设计模式
    读大型网站技术架构后感
    以《淘宝以《淘宝网》为例,描绘质量属性的六个常见属性场景。
    以《淘宝网》为例,描绘质量属性的六个常见属性场景。
  • 原文地址:https://www.cnblogs.com/rosizel/p/3859390.html
Copyright © 2011-2022 走看看