コード例 #1
0
 public static RomanEmployee Start()
 {
     if (instance == null)
     {
         instance           = new RomanEmployee();
         instance.startWork = DateTime.Now;
     }
     return(instance);
 }
コード例 #2
0
        static void Main(string[] args)
        {
            //Console.WriteLine("Roman rozpoczyna pracę");
            //RomanEmployee.Start();
            //Console.WriteLine($"Pracownik jest w pracy: {RomanEmployee.IsWorking()}");
            //Console.WriteLine("Roman kończy pracę");
            //RomanEmployee.Stop();
            //Console.WriteLine($"Pracownik jest w pracy: {RomanEmployee.IsWorking()}");
            //Console.ReadKey();

            //Bonus
            Console.WriteLine("Roman nie pracuje");
            Console.WriteLine($"Pracownik pracuje już {RomanEmployee.WorkingTime()}");
            Console.WriteLine("Roman pracuje");
            RomanEmployee.Start();
            Thread.Sleep(3000);
            Console.WriteLine($"Pracownik pracuje już {RomanEmployee.WorkingTime()}");
            Console.Read();
        }
コード例 #3
0
 public static void Stop()
 {
     instance = null;
 }