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(); }
public void Add(DailySkill s) { DailySkill _s = Find(s); if (_s != null) { return; } this.DailySkills.Add(s); AddSkillEntry(s.SkillType); s.SetOwner(this); }
public DailySkill Find(DailySkill s) => this.DailySkills.FirstOrDefault(elem => elem.Equals(s));
public bool Contains(DailySkill s) => TimeSpentForSkills.Keys.Any(e => e == s.SkillType);
public void Remove(DailySkill s) => this.DailySkills.Remove(s);