private void AddNewTimespan()
        {
            string     skillName = SkillTypesComboBox.SelectedItem as string;
            Skill      skillType = (Skill)Enum.Parse(typeof(Skill), skillName);
            DailySkill skill     = new DailySkill(skillType);
            object     o         = this.TimeStatisticsView.SelectedItem;

            if (o == null)
            {
                var daily = this.AddDaily();
                daily.Add(skill);
                daily.AddSkillEntry(skillType, this.skillTimer.Elapsed);
            }
            else if (o is DailyTimeStatistic dts)
            {
                dts.Add(skill);
                dts.AddSkillEntry(skillType, this.skillTimer.Elapsed);
            }
            else if (o is DailySkill ds)
            {
                ds.GetOwner()?.Add(skill);
                ds.GetOwner()?.AddSkillEntry(skillType, this.skillTimer.Elapsed);
            }
            this.skillTimer.Reset();
        }
Exemple #2
0
        public void Add(DailySkill s)
        {
            DailySkill _s = Find(s);

            if (_s != null)
            {
                return;
            }
            this.DailySkills.Add(s);
            AddSkillEntry(s.SkillType);
            s.SetOwner(this);
        }
Exemple #3
0
 public DailySkill Find(DailySkill s) => this.DailySkills.FirstOrDefault(elem => elem.Equals(s));
Exemple #4
0
 public bool Contains(DailySkill s) => TimeSpentForSkills.Keys.Any(e => e == s.SkillType);
Exemple #5
0
 public void Remove(DailySkill s) => this.DailySkills.Remove(s);