Пример #1
0
        private bool IsInkEnough(Ink ink)
        {
            bool enough = true;

            if (ink.Amount < 1)
            {
                OutOfInk?.Invoke(this, new OutOfInkEventArgs(ink.Color));
                enough = false;
            }

            return(enough);
        }
Пример #2
0
 public void Print(int pageNumber)
 {
     if (_random.NextDouble() < 0.01)
     {
         // generowanie Eventu
         // OnPaperJammed(EventArgs.Empty);
         PaperJammed.Invoke(this, new PaperJammedEventArgs(pageNumber));
     }
     else
     {
         Console.WriteLine("Etykieta");
         _inks.ForEach(x =>
         {
             x.Level -= _random.NextDouble() * 0.1;
             if (x.Level <= 0)
             {
                 OutOfInk.Invoke(this, new OutOfInkEventArgs(x.Color, pageNumber));
             }
         }
                       );
     }
 }