Exemplo n.º 1
0
 protected virtual void OnCounterFinish(CounterEventArgs e)
 {
     if (this.CounterFinishHandler != null)
     {
         this.CounterFinishHandler(this, e);
     }
 }
Exemplo n.º 2
0
 protected virtual void OnCounterChange(CounterEventArgs e)
 {
     if (this.CounterChangeHandler != null)
     {
         this.CounterChangeHandler(this, e);
     }
 }
Exemplo n.º 3
0
 // Event Methoden
 protected virtual void OnCounterStart(CounterEventArgs e)
 {
     if (this.CounterStartHandler != null)
     {
         this.CounterStartHandler(this, e);
     }
 }
Exemplo n.º 4
0
        private void OnTick()
        {
            // Student --- Add code to :
            // 1. Check if clients are registered (if not - return)
            if (OnCounterEvent == null)
            {
                return;
            }
            // 2. Create EventArg information: what is the counted value
            CounterEventArgs counterEventArgs = new CounterEventArgs(CountedValue);

            // 3. Report the event to the registered clients, with the
            //    call to Invoke the clients response, where the sender
            //     is the counter, and the EventArgs is the one you prepared above
            OnCounterEvent.Invoke(this, counterEventArgs);
        }
Exemplo n.º 5
0
 // Student --- Add a method that responds to the event, the method
 // input and output should be the same as the delegate definition in the event
 private void Server_OnCounterEvent(Counter counter, CounterEventArgs e)
 {
     Console.WriteLine($"{e.CounterValue}");
 }