示例#1
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;
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Scramble scramble = new Scramble();

            Console.WriteLine(scramble.ToString());
            //Timer = new CubingTimer(new User(1, "name", "lname")); // TODO: Fix to the current user
            Timer.LoadScramble(scramble);
            Timer.Started        += Timer_Started;
            Handlers.TimeChanged += CurrentTime_TimeChanged;
            Timer.TimerStoped    += Timer_TimerStoped;
            newThread             = new Thread(ThreadVoid);

            for (Int32 i = 3; i > 0; i--)
            {
                Console.WriteLine($"Timer starts in {i} sec");
                Thread.Sleep(1000);
            }
            Console.WriteLine("P.S. Pls, write something to stop timer!");
            Timer.Start();
            newThread.Start();
        }