Ejemplo n.º 1
0
        private void Power_PropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            string strPropertyName = propertyChangedEventArgs?.PropertyName;

            if (strPropertyName == nameof(PowerObject.FreeLevels) || strPropertyName == nameof(PowerObject.TotalRating))
            {
                PowerObject.DisplayPoints = PowerObject.PowerPoints.ToString(GlobalOptions.CultureInfo);
                tipTooltip.SetToolTip(lblPowerPoints, PowerObject.ToolTip());
                cmdDelete.Enabled = PowerObject.FreeLevels == 0;
            }
            if (strPropertyName == nameof(PowerObject.Name))
            {
                PowerObject.CharacterObject.SkillsSection.PropertyChanged -= Power_PropertyChanged;
                if (PowerObject.Name == "Improved Ability (skill)")
                {
                    PowerObject.CharacterObject.SkillsSection.PropertyChanged += Power_PropertyChanged;
                }
            }
            // Super hacky solution, but we need all values updated properly if maxima change for any reason
            if (strPropertyName == nameof(PowerObject.TotalMaximumLevels))
            {
                nudRating.Maximum = PowerObject.TotalMaximumLevels;
            }
            else if (PowerObject.Name == "Improved Ability (skill)" || strPropertyName == nameof(PowerObject.CharacterObject.MAG.TotalValue) || strPropertyName == nameof(PowerObject.CharacterObject.MAGAdept.TotalValue))
            {
                PowerObject.ForceEvent(nameof(PowerObject.TotalMaximumLevels));
            }
        }
Ejemplo n.º 2
0
        private void Power_PropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
        {
            switch (propertyChangedEventArgs?.PropertyName)
            {
            case nameof(PowerObject.CharacterObject.MAG.TotalValue):
            //TODO: For skills - probably needs to be rebound to something more specific?
            case "Karma":
                PowerObject.ForceEvent(nameof(PowerObject.TotalMaximumLevels));
                break;

            case nameof(PowerObject.FreeLevels):
            case nameof(PowerObject.TotalRating):
                PowerObject.DisplayPoints = PowerObject.PowerPoints.ToString();
                tipTooltip.SetToolTip(lblPowerPoints, PowerObject.ToolTip());
                cmdDelete.Enabled = PowerObject.FreeLevels == 0;
                break;
            }
        }