示例#1
0
        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);
            }
        }
示例#2
0
 void OnCounterChanged(int oldValue, int newValue)
 {
     if (CounterChanged != null)
     {
         CounterChanged.Invoke(this, new EventRaiserCounterChangedEventArgs(oldValue, newValue));
     }
 }
示例#3
0
        private static int NextCounterValue()
        {
            var next = Interlocked.Increment(ref _constructorCounter);

            CounterChanged?.Invoke(null, null);
            return(next);
        }
示例#4
0
 private void OnCounterChanged(string value)
 {
     CounterChanged?.Invoke(this, new CounterChangedEventArgs(value));
 }
示例#5
0
 private void UpdateState(CounterChanged e)
 {
     _count += e.Delta;
 }
 private void UpdateState(CounterChanged e)
 {
     _count += e.Delta;
 }
示例#7
0
 public void Subscribe(CounterChanged counterChangedDelegateInstance)
 {
     handlers.Add(counterChangedDelegateInstance);
     //CounterChangedDelegate += counterChangedDelegateInstance;
 }
示例#8
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     _clickCount++;
     CounterChanged?.Invoke(_clickCount);
 }
 public void IncreaseCounter()
 {
     _counter++;
     CounterChanged?.Invoke(_counter);
 }
示例#10
0
 public void CountOne()
 {
     number++;
     CounterChanged?.Invoke(this, number);
 }
示例#11
0
 private void UpdateState(CounterChanged @event)
 {
     _count += @event.Delta;
 }