Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Threading;
- using System.Runtime;
- namespace Timer
- {
- class Timer
- {
- public static void Main (string[] args)
- {
- Console.Title = "C# Timer";
- ConsoleColor defaultBackgroundColor = ConsoleColor.Black;
- ConsoleColor defaultForegroundColor = ConsoleColor.White;
- Console.BackgroundColor = ConsoleColor.White;
- Console.ForegroundColor = ConsoleColor.Black;
- Console.WriteLine ("=================================");
- Console.WriteLine ("= =");
- Console.WriteLine ("= ***** ***** ** ** ***** **** =");
- Console.WriteLine ("= * * * * * * * * =");
- Console.WriteLine ("= * * * * * * * =");
- Console.WriteLine ("= * * * * *** **** =");
- Console.WriteLine ("= * * * * * ** =");
- Console.WriteLine ("= * * * * * * * =");
- Console.WriteLine ("= * ***** * * ***** * ** =");
- Console.WriteLine ("= =");
- Console.WriteLine ("=================================");
- Console.BackgroundColor = defaultBackgroundColor;
- Console.ForegroundColor = defaultForegroundColor;
- Console.WriteLine ();
- Console.WriteLine ("Enter the number of seconds below.");
- Console.Write ("SECONDS>> ");
- String secondsString = Console.ReadLine ();
- if (secondsString == "/help") {
- Console.WriteLine ("Here is a way to get the number of seconds you need: s = m * 60, where s is sec-onds and m is minutes.");
- } else if (secondsString != "/help") {
- int numberInt = Convert.ToInt32 (secondsString);
- Console.ForegroundColor = ConsoleColor.Green;
- System.Media.SoundPlayer subtractSound = new System.Media.SoundPlayer();
- subtractSound.SoundLocation = "C:/Users/Aaron/Desktop/More Stuff/Timer/Timer/res/S2HDSFX - Tally Switch.wav";
- subtractSound.Load();
- //subtractSound.PlayLooping ();
- System.Media.SoundPlayer endSound = new System.Media.SoundPlayer();
- endSound.SoundLocation = "C:/Users/Aaron/Desktop/More Stuff/Timer/Timer/res/S2HDSFX - Tally End.wav";
- endSound.Load();
- for (int i = numberInt; i >= 0; i--) {
- if (i > 1) {
- Thread.Sleep(1000);
- Console.WriteLine (i + " SECONDS LEFT");
- subtractSound.Play ();
- } else if (i == 1) {
- Thread.Sleep(1000);
- Console.WriteLine (i + " SECOND LEFT");
- subtractSound.Play ();
- } else if (i == 0) {
- Thread.Sleep(1000);
- Console.Write("DONE!");
- //subtractSound.Stop ();
- endSound.Play ();
- Console.ForegroundColor = defaultForegroundColor;
- Console.BackgroundColor = defaultBackgroundColor;
- }
- }
- }
- Thread.Sleep (System.Threading.Timeout.Infinite);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment