Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            var container = new CentralContainer();

            container.ComposeComponents();

            IProducer p1Producer = container.GetProducer("P1");

            p1Producer.Execute();

            IProducer p2Producer = container.GetProducer("P2");

            p2Producer.Execute();

            Console.ReadLine();
        }
Exemplo n.º 2
0
 public void Register(IProducer s)
 {
     tasks.Add(
         Task.Run(() => s.Execute(), CancellationTokenSource.Token)
         .ContinueWith(Stop));
 }