Example #1
0
 private void ResetMax()
 {
     foreach (var item in list.Children)
     {
         SkillPanel pnl = item as SkillPanel;
         if (pnl != null)
         {
             pnl.Maximum = this.MaximumSkillValue;
         }
     }
 }
Example #2
0
        private void BindSkills()
        {
            this.SkillPoints = SkillPointsMaximum;
            list.Children.Clear();
            if (this.SkillsSource != null && this.SkillsSource.Count() > 0)
            {
                // Sort the skills.
                string group = String.Empty;
                Game.EnsureSkillDetails(this.SkillsSource);
                foreach (var item in this.SkillsSource.OrderBy(s => s.GroupName))
                {
                    if (group != item.GroupName)
                    {
                        group = item.GroupName;
                        TextBlock txt = new TextBlock();
                        txt.FontFamily = new FontFamily("Georgia");
                        txt.FontSize   = 12;
                        txt.FontWeight = FontWeights.Bold;
                        txt.Text       = item.GroupName;
                        txt.Foreground = Brushes.HeadingBrush;
                        txt.Padding    = new Thickness(0, 0, 0, 4);
                        list.Children.Add(txt);
                    }

                    if (item.Value <= 0 && !this.ShowUntrainedSkills)
                    {
                        continue;
                    }

                    SkillPanel pnl = new SkillPanel(item, this.EnableButtons);
                    pnl.Maximum        = this.MaximumSkillValue;
                    pnl.SkillChanging += new SkillChangedEventHandler(OnSkillChanging);
                    pnl.SkillChanged  += new SkillChangedEventHandler(OnSkillChanged);
                    list.Children.Add(pnl);
                    this.SkillPoints -= item.Value;
                }
            }
            if (this.SkillPoints > SkillPointsMaximum)
            {
                this.SkillPoints = SkillPointsMaximum;
            }
            if (this.SkillPoints < 0)
            {
                this.SkillPoints = 0;
            }
            lblSkillPoints.Text = this.SkillPoints.ToString();
        }