Beispiel #1
0
        /// <summary>
        /// 監控裝置 - 顯示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ShowMsg(object sender, ProductFactory.CreatedEventArgs e)
        {
            var foo      = Rm.Next(500, 2000);
            var threadId = Thread.CurrentThread.ManagedThreadId;

            Console.WriteLine($"Monitor.ThreadId:{threadId},Sleep {foo}");
            Thread.Sleep(Rm.Next(500, 2000));

            Console.WriteLine($"Monitor.ShowMsg =>ThreadId:{threadId}, 工廠:{((ProductFactory)sender).FactoryName}, 生產產品:{e.ProductName}");
        }
Beispiel #2
0
        /// <summary>
        /// 顯示器 - 顯示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void Display(object sender, ProductFactory.CreatedEventArgs e)
        {
            var foo      = Rm.Next(500, 2000);
            var threadId = Thread.CurrentThread.ManagedThreadId;

            Console.WriteLine($"Screen.ThreadId:{threadId},Sleep {foo}");
            Thread.Sleep(Rm.Next(500, 2000));

            Console.WriteLine(
                $"Screen.Display =>ThreadId:{Thread.CurrentThread.ManagedThreadId}, 工廠:{((ProductFactory) sender).FactoryName}, 生產產品:{e.ProductName}");
        }