예제 #1
0
        private void OnBeehiveChanged(IBeehive sender, BeehiveChangedEventArgs args)
        {
            var model = Beehives.First(beehive => beehive.Number == sender.Number);

            dp.Dispatcher
            .ExecuteAsync(() =>
            {
                switch (args.Acion)
                {
                case BeehiveAcion.BeeAdded:
                    {
                        model.CurrentBeesCount++;
                        break;
                    }

                case BeehiveAcion.BeeRemoved:
                    {
                        model.CurrentBeesCount--;
                        break;
                    }
                }
            })
            .RunAndForget();
        }
예제 #2
0
 /// <summary>
 /// Инициализирует новый экземпляр класса <see cref="T:System.Object"/>.
 /// </summary>
 public Bee(IBeehive beehive, int number, IBeeBehaviour behaviour)
 {
     Beehive   = beehive;
     Number    = number;
     Behaviour = behaviour;
 }