コード例 #1
0
ファイル: Program.cs プロジェクト: CHIZHIDA/ConsoleDemo
 //可以提供继承Header的类重写,以便继承类拒绝其他对象怼它的监视
 protected virtual void OnBoiled(BoilEventArgs e)
 {
     if (Boiled != null)
     {
         Boiled(this, e);     //调用所有注册对象的方法
     }
 }
コード例 #2
0
 protected virtual void OnBoiled(BoilEventArgs e)
 {
     if (Boil != null)
     { // 如果有对象注册
         //Boil(this, e);
         Boil.BeginInvoke(this, e, null, null);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: CHIZHIDA/ConsoleDemo
 //烧水
 public void BoilWater()
 {
     for (int i = 0; i < 100; i++)
     {
         temperature = i;
         if (temperature > 95)
         {
             //建立BoilEventArgs对象。
             BoilEventArgs e = new BoilEventArgs(temperature);
             OnBoiled(e);        //调用OnBoiled方法
         }
     }
 }
コード例 #4
0
        public void BeginBoilWater()
        {
            for (int i = 0; i < 100; i++)
            {
                temperature = i;

                if (temperature > 95)
                {
                    BoilEventArgs e = new BoilEventArgs(temperature);
                    Boil(this, e);
                    //OnBoiled(e);
                }
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: tongle92/StudyDemo
 //供子类继承重写
 protected virtual void OnBoiled(BoilEventArgs e)
 {
     if (Boil != null)
         Boil(this, e);
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: tongle92/StudyDemo
        //加热方法
        public void BoilWater()
        {
            for (int i = 0; i < 100; i++)
            {
                temperature = i;
                if (temperature > 95)
                {
                    //构造对象
                    BoilEventArgs e = new BoilEventArgs(temperature);
                    //调用OnBoiled方法
                    OnBoiled(e);
                }

            }
        }