Exemple #1
0
        private void UpdateLevel()
        {
            var previousLevel = Level;

            if (_points <= _appSettings.PointsToLevel1)
            {
                Level = 0;
            }
            else if (_points <= _appSettings.PointsToLevel2)
            {
                Level = 1;
            }
            else if (_points <= _appSettings.PointsToLevel3)
            {
                Level = 2;
            }
            else if (_points <= _appSettings.PointsToLevel4)
            {
                Level = 3;
            }
            else if (_points <= _appSettings.PointsToLevel5)
            {
                Level = 4;
            }
            else
            {
                Level = 5;
            }

            if (previousLevel != Level)
            {
                LevelChanged.SafelyInvoke(new StateChange <int>(previousLevel, Level));
            }
        }