Пример #1
0
        public static void Render()
        {
            if (_showCount <= 0)
            {
                return;
            }

            GUIGraphicsContext.SetScalingResolution(0, 0, false);

            if (_countDown)
            {
                // Set the count label value and position in the center of the window.
                _timeElapsed = DXUtil.timeGetTime() - _startTime;
                if (_timeElapsed >= ONE_SECOND)
                {
                    _startTime   = DXUtil.timeGetTime();
                    _timeElapsed = 0.0f;
                    _countValue--;
                    if (_countValue < 0)
                    {
                        // Invoke the users callback method and disable the cursor.
                        // The callback must be invoked in a separte thread otherwise it gets executed in the window render loop which
                        // can cause conflicts (especially if the users callback method makes calls that may change the window rendering).
                        guiWaitCursorThread = new Thread(GUIWaitCursorElapsedEventThread);
                        guiWaitCursorThread.IsBackground = true;
                        guiWaitCursorThread.Name         = "WaitcursorElapsedEvent";
                        guiWaitCursorThread.Start();
                        Hide();
                        return;
                    }
                }

                int offset = 5;
                int xPos   = (GUIGraphicsContext.Width / 2) - 48;
                int yPos   = (GUIGraphicsContext.Height / 2) - 48 + offset;
                _countLabel.SetPosition(xPos, yPos);
                _countLabel.Label = _countValue.ToString();
                _countLabel.Render(GUIGraphicsContext.TimePassed);
            }

            _animation.Render(GUIGraphicsContext.TimePassed);
        }