public static void Main(string[] args)
        {
            var startComment = new StringBuilder();

            var startPrompt         = "Did you use the Internet before starting the Internet Monitor?";
            var startPromptResponse = GetUserInput(startPrompt + " (yes/no)");

            startComment.AppendLine(startPrompt + " " + startPromptResponse);
            startComment.AppendLine($"Comments: {GetUserInput("Please provide comments.")}");

            var history = new InternetHistory();

            history.Start(startComment.ToString());

            var timer = new Timer {
                Interval = 1000
            };

            timer.Elapsed += OnTimer;
            timer.Start();

            do
            {
                try
                {
                    Console.WriteLine("Type 'comment' or 'exit'.");
                    var input = Console.ReadLine();

                    if (string.IsNullOrEmpty(input))
                    {
                        continue;
                    }

                    if (input == "comment")
                    {
                        history.WriteEntry(GetUserInput("Enter comments."), string.Empty);
                        continue;
                    }
                    if (input != "exit")
                    {
                        continue;
                    }

                    history.Stop(GetUserInput("Please enter a reason."));
                    break;
                }
                catch (Exception e)
                {
                    log.Error(e, "Unknown Error.");
                }
            }while (true);
        }
Beispiel #2
0
        protected override void OnShutdown()
        {
            var history = new InternetHistory();

            history.Stop("Shutting Down.");
        }
Beispiel #3
0
        protected override void OnPause()
        {
            var history = new InternetHistory();

            history.Stop("Pausing.");
        }
Beispiel #4
0
        protected override void OnStop()
        {
            var history = new InternetHistory();

            history.Stop("Stopping.");
        }