public static RomanEmployee Start() { if (instance == null) { instance = new RomanEmployee(); instance.startWork = DateTime.Now; } return(instance); }
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(); }
public static void Stop() { instance = null; }