public void AddMove(Direction dir) { moves.Add(dir); if (moves.Count >= 2) { if (moves[0] == moves[1]) { moves.Clear(); return; } int tmpValue = moves[0] == Direction.In ? 1 : -1; Counter += tmpValue; moves.Clear(); if (Counter < -1) { Counter = -1; return; } CounterChanged?.Invoke(tmpValue); } }
void OnCounterChanged(int oldValue, int newValue) { if (CounterChanged != null) { CounterChanged.Invoke(this, new EventRaiserCounterChangedEventArgs(oldValue, newValue)); } }
private static int NextCounterValue() { var next = Interlocked.Increment(ref _constructorCounter); CounterChanged?.Invoke(null, null); return(next); }
private void OnCounterChanged(string value) { CounterChanged?.Invoke(this, new CounterChangedEventArgs(value)); }
private void UpdateState(CounterChanged e) { _count += e.Delta; }
public void Subscribe(CounterChanged counterChangedDelegateInstance) { handlers.Add(counterChangedDelegateInstance); //CounterChangedDelegate += counterChangedDelegateInstance; }
private void Button_Click(object sender, RoutedEventArgs e) { _clickCount++; CounterChanged?.Invoke(_clickCount); }
public void IncreaseCounter() { _counter++; CounterChanged?.Invoke(_counter); }
public void CountOne() { number++; CounterChanged?.Invoke(this, number); }
private void UpdateState(CounterChanged @event) { _count += @event.Delta; }