Exemplo n.º 1
0
        private static void ThreadVoid()
        {
            bool reqstoptimer = false;

            while (!reqstoptimer)
            {
                ConsoleKeyInfo s = Console.ReadKey();
                if (!s.Equals(null))
                {
                    reqstoptimer = true;
                    Timer.Stop();
                    Console.WriteLine($"Timer stoped! Time solved -> {Timer.LastTimeSolved}");
                }
            }
            Console.WriteLine("Press enter to start timer again or press Esc to exit the timer.");
            var key = Console.ReadKey();

            if (key.Key.Equals(ConsoleKey.Enter))
            {
                Console.Clear(); Main(null);
            }
            if (key.Key.Equals(ConsoleKey.Escape))
            {
                Console.Clear(); Environment.Exit(0);
            }
        }
Exemplo n.º 2
0
        private async void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (Timer != null)
            {
                if (Timer.IsTimerWorking && CanTimerStart == false)
                {
                    Timer.Stop();
                    sec2.IsEnabled = true;
                    dnf.IsEnabled  = true;
                    SDNF           = false;
                    SSEC2          = false;
                    await GetEveryAverage();

                    stoped          = true;
                    textblock1.Text = Timer.LastTimeSolved.ToString();
                    Focus();
                }
                else if (Timer.IsTimerWorking == false && task1 == null)
                {
                    CanTimerStart  = false;
                    sec2.IsEnabled = false;
                    dnf.IsEnabled  = false;
                    InitializeCubingTimer();
                    Timer.LoadScramble(scramble1);
                    RedGreen(e);
                    return;
                }
            }
            else
            {
                CanTimerStart  = false;
                sec2.IsEnabled = false;
                dnf.IsEnabled  = false;
                InitializeCubingTimer();
                Timer.LoadScramble(scramble1);
                RedGreen(e);
                return;
            }
        }