private void UpdateFields() { // check if we are in a challenge if (!_challenge.Load()) { NoChallenge.Visibility = Visibility.Visible; return; } NoChallenge.Visibility = Visibility.Hidden; if (_updateDelay.ElapsedMilliseconds >= 1000) { _delayedUpdate = false; } Level.Text = _challenge.GetLevel() switch { "spikyroad" => "The Neverending Pit", "run" => "Land of the Livid Dead", "goingup" => "The Infinite Tower", "drc" => "Murfy's Dungeon", "shaolin" => "The Dojo", _ => "Unknown level" }; Difficulty.Text = "Difficulty: " + _challenge.GetDifficulty() switch { "expert" => "Expert", "normal" => "Normal", _ => "Unknown" }; _online = _challenge.IsOnline(); Mode.Text = "Mode: " + (_online ? "Online" : "Training"); // we assume that the challenge isn't ready as long as both the // challenge seed and generator seed don't share the same value var seed = _challenge.GetChallengeSeed(); var challengeReady = seed == _challenge.GetGeneratorSeed(); Seed.IsEnabled = !_online && challengeReady; Random.IsEnabled = Seed.IsEnabled; if (!Seed.IsKeyboardFocused || !_delayedUpdate) { Seed.Text = FormatSeed(seed); } var type = _challenge.GetChallengeType(); Type.SelectedIndex = TypeToIndex(type); Type.IsEnabled = !_online; GoalUnit.Text = type switch { Challenge.Type.GrabThemQuickly => "lums", Challenge.Type.GetThereQuickly => "meters", Challenge.Type.AgainstTheClock => "sec", Challenge.Type.GrabThereQuickly2 => "sec", _ => "" }; LimitUnit.Text = type switch { Challenge.Type.AsFarAsYouCan => "meters", Challenge.Type.GrabThemQuickly => "sec", Challenge.Type.GetThereQuickly => "sec", Challenge.Type.AgainstTheClock => "meters", Challenge.Type.AsManyAsYouCan => "lums", Challenge.Type.GrabThereQuickly2 => "lums", _ => "" }; if (type == Challenge.Type.AsFarAsYouCan || type == Challenge.Type.AsManyAsYouCan) { Goal.IsEnabled = false; Goal.Text = "n/a"; } else if (!Goal.IsKeyboardFocused || !_delayedUpdate) { Goal.IsEnabled = !_online; Goal.Text = _challenge.GetGoal().ToString(CultureInfo.InvariantCulture); } if (!Limit.IsKeyboardFocused || !_delayedUpdate) { Limit.Text = _challenge.GetLimit().ToString(CultureInfo.InvariantCulture); } Limit.IsEnabled = !_online; }