Exemplo n.º 1
0
        public static void ShowPrefix()
        {
            if (stopwatch is Stopwatch sw && sw.IsRunning)
            {
                return;
            }

            benchmarking = VirtualKey.GetKey(KeyCode.LeftControl);
            if (benchmarking)
            {
                Logger.LogMessage("Running benchmark without boosts for comparison, starting timer...");
            }
            else
            {
                Logger.LogInfo("Boosting loading times...");
                frameRate = Application.targetFrameRate;
                Application.targetFrameRate = -1;

                vSyncCount = QualitySettings.vSyncCount;
                QualitySettings.vSyncCount = 0;
            }
            stopwatch = Stopwatch.StartNew();
        }
Exemplo n.º 2
0
        private void LetterButtonClick(object sender, RoutedEventArgs e)
        {
            VirtualKey key = sender as VirtualKey;

            if (key == null || ReferenceTextBox == null)
            {
                return;
            }

            string letter = key.GetKey();
            int    length = ReferenceTextBox.Text.Length;

            //Special case
            if (key.Key == Windows.System.VirtualKey.Back)
            {
                if (length > 0)
                {
                    ReferenceTextBox.Text = ReferenceTextBox.Text.Remove(length - 1, 1);
                }
            }
            else if (key.Key == Windows.System.VirtualKey.Space)
            {
                ReferenceTextBox.Text += " ";
            }
            else if (key.Key == Windows.System.VirtualKey.LeftShift)
            {
                if (!_leftShiftEnabled)
                {
                    _leftShuftKey            = key;
                    _leftShiftPreviousColor  = _leftShuftKey.Background;
                    _leftShuftKey.Background = new SolidColorBrush(Colors.LightBlue);
                    _leftShiftEnabled        = true;
                }
                else
                {
                    _leftShuftKey.Background = _leftShiftPreviousColor;
                    _leftShiftEnabled        = false;
                }
                return;
            }
            else
            {
                //Always start as lower
                letter = letter.ToLower();

                if (_leftShiftEnabled)
                {
                    if (key.HasShiftKey)
                    {
                        letter = key.GetShiftKey();
                    }
                    else
                    {
                        letter = letter.ToUpper();
                    }
                }

                ReferenceTextBox.Text += letter;
            }

            if (_leftShuftKey != null &&
                _leftShiftPreviousColor != null)
            {
                _leftShuftKey.Background = _leftShiftPreviousColor;
            }
            _leftShiftEnabled = false;
        }