public AsciiKello(Timetracker a_timetracker) { m_timetracker = a_timetracker; m_timer = new Timer(); m_timer.Elapsed += new ElapsedEventHandler(Tick); m_timer.Interval = 1000; }
static void Main(string[] args) { quotaTracker = new Classes.QuotaTracker(); timeTracker = new Classes.Timetracker(quotaTracker); clock = new Classes.AsciiKello(timeTracker); handler = new ConsoleEventDelegate(ConsoleEventCallback); SetConsoleCtrlHandler(handler, true); PrintInstructions(); while (true) { string line = Console.ReadLine(); if (line == "s" || line == "e") { if (!timeTracker.IsRunning()) { timeTracker.Start(); clock.Start(); } else { timeTracker.Stop(); clock.Stop(); } } else if (line == "c") { Console.Clear(); clock.Redraw(); if (timeTracker.m_isRunning) { timeTracker.PrintStart(); } else { PrintInstructions(); } } else if (line == "x") { break; } else if (line.StartsWith("u")) { Classes.UpworkTimePrinter.PrintTimes(line); } else { Console.WriteLine("Unknown command: " + line); } Console.WriteLine(); } }