zoukankan      html  css  js  c++  java
  • BaseWorkerForm : Form

    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(object obj)
            {
                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;
            }
        }
    }
  • 相关阅读:
    C#时间格式转换问题(12小时制和24小时制)
    ajax跨域请求webservice webconfig配置
    C#时间戳转化为DateTime
    C#生成缩略图
    codeforces-1348-C Phoenix and Distribution
    P4314 CPU监控
    YangK's dfs序与树链剖分
    Yangk's 静态主席树
    P2253 好一个一中腰鼓!
    codeforces-1341D-Nastya and Scoreboard 记忆化搜索
  • 原文地址:https://www.cnblogs.com/rosizel/p/3861616.html
Copyright © 2011-2022 走看看