示例#1
0
 public Cook(IPublisher publisher, IHorn horn, string cookName, int processingTime)
 {
     _publisher      = publisher;
     _horn           = horn;
     _cookName       = cookName;
     _processingTime = processingTime;
 }
        private static void StartPrintingQueueStats(IHorn horn, IList <ITrackable> trackables, StatsProjection statsProjection)
        {
            var thread = new Thread(() =>
            {
                while (true)
                {
                    horn.Note("[stats]: " + JsonConvert.SerializeObject(new
                    {
                        queueLengths    = trackables.ToDictionary(x => x.QueueName, x => x.QueueDepth),
                        statsProjection = statsProjection
                    }, Formatting.Indented));
                    Thread.Sleep(500);
                }
            })
            {
                IsBackground = true
            };

            thread.Start();
        }
示例#3
0
 IHorn horn;                                 // IHorn (Interface) là một Dependecy của Car
 public Car(IHorn horn) => this.horn = horn; // Inject từ hàm  tạo
示例#4
0
 public Cashier(IPublisher publisher, IHorn horn)
 {
     _publisher = publisher;
     _horn      = horn;
 }
 public Waiter(IPublisher publisher, IHorn horn)
 {
     _publisher = publisher;
     _horn      = horn;
 }
 public Printer(IHorn horn)
 {
     _horn = horn;
 }
 public AssistantManager(IPublisher publisher, IHorn horn)
 {
     _publisher = publisher;
     _horn      = horn;
 }
示例#8
0
            IHorn horn;    // horn là một Dependecy của Car, triển khai từ Interface IHorn

            public Car(IHorn horn) => this.horn = horn;