示例#1
0
 public void Ignite(object sender, SwitchedEventArgs e)
 {
     if (e.State)
     {
         Console.WriteLine("Tubelight is ON");
     }
     else
     {
         Console.WriteLine("Tubelight is OFF");
     }
 }
示例#2
0
 public void Burn(object sender, SwitchedEventArgs e)
 {
     if (e.State)
     {
         Console.WriteLine("lightbulb is ON");
     }
     else
     {
         Console.WriteLine("lightbulb is OFF");
     }
 }
示例#3
0
        protected virtual void OnSwitched(SwitchedEventArgs e)
        {
            SwitchedEventHandler temp = Switched;   // make it thread-safe

            temp?.Invoke(this, e);
        }