Vereinsmeisterschaften  22aa7800eae54b428d40e835886cefe1fdefdfdf
This is a software that can be used to manage the internal competition of the swimming club Illertissen called "Vereinsmeisterschaften".
Loading...
Searching...
No Matches
PersonStart.cs
1using CommunityToolkit.Mvvm.ComponentModel;
2
4{
8 public partial class PersonStart : ObservableObject, IEquatable<PersonStart>, ICloneable
9 {
10 #region Constructors
11
15 public PersonStart()
16 {
17 }
18
23 public PersonStart(PersonStart other) : this()
24 {
25 if (other == null) { return; }
26 this.PersonObj = other.PersonObj;
27 this.CompetitionObj = other.CompetitionObj;
28 this.Style = other.Style;
29 this.Time = other.Time;
30 this.Score = other.Score;
31 this.IsHighlighted = other.IsHighlighted;
32 this.IsActive = other.IsActive;
33 }
34
35 #endregion
36
37 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
38
39 #region Basic properties
40
44 [ObservableProperty]
46
50 [ObservableProperty]
52
53 private TimeSpan _time;
57 public TimeSpan Time
58 {
59 get => _time;
60 set
61 {
62 if (SetProperty(ref _time, value))
63 {
64 OnPropertyChanged(nameof(IsTimeSet));
65 }
66 }
67 }
68
72 public bool IsTimeSet => Time != TimeSpan.Zero;
73
77 [ObservableProperty]
78 private double _score;
79
83 [ObservableProperty]
84 private bool _isActive = true;
85
86 #endregion
87
88 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
89
90 #region Competition related properties
91
92 private Competition _competitionObj;
97 {
98 get => _competitionObj;
99 set
100 {
101 if (SetProperty(ref _competitionObj, value))
102 {
103 OnPropertyChanged(nameof(IsCompetitionObjAssigned));
104 }
105 }
106 }
107
112
117 [ObservableProperty]
119
124 [ObservableProperty]
126
127 #endregion
128
129 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
130
131 #region Other properties
132
136 [ObservableProperty]
137 private bool _isHighlighted;
138
139 #endregion
140
141 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
142
143 #region Equality, HashCode, ToString, Clone
144
150 public override bool Equals(object obj)
151 => obj is PersonStart s && (s.PersonObj, s.Style, s.Time, s.IsActive).Equals((PersonObj, Style, Time, IsActive));
152
158 public bool Equals(PersonStart other)
159 => Equals((object)other);
160
165 public override int GetHashCode()
166 => (PersonObj, Style, Time, IsActive).GetHashCode();
167
172 public override string ToString()
173 => $"{(!IsActive ? "Inactive " : "")}Start for {PersonObj} in {Style}" + (CompetitionObj != null ? $" (Distance: {CompetitionObj.Distance}m)" : "");
174
179 public object Clone()
180 => new PersonStart(this);
181
182 #endregion
183 }
184}
Class describing a competition.
Class describing a person.
Definition Person.cs:12
PersonStart(PersonStart other)
Clone constructor for a new PersonStart object.
object Clone()
Create a new object that has the same property values than this one.
bool _isHighlighted
Flag indicating if this start should be highlighted in the UI.
bool IsTimeSet
True if the Time is set (not TimeSpan.Zero)
bool _isUsingMaxAgeCompetition
Flag indicating if this start is using a competition that was found by the max available age.
Person _personObj
Reference to the person object to which the start belongs.
bool _isActive
Indicates if this start is currently active.
bool IsCompetitionObjAssigned
Flag indicating if the CompetitionObj is assigned (CompetitionObj != null).
override string ToString()
Returns a string that represents the current object.
SwimmingStyles _style
SwimmingStyles of the start
double _score
Score of the person for this start.
PersonStart()
Constructor for a new PersonStart object.
bool _isUsingExactAgeCompetition
Flag indicating if this start is using a competition for which the age of the person matches the comp...
bool Equals(PersonStart other)
Indicates wheather the current object is equal to another object of the same type.
TimeSpan Time
Time the person needed during the race of this start.
Competition CompetitionObj
Reference to the competition object to which the start belongs.
override bool Equals(object obj)
Compare if two PersonStarts are equal.
override int GetHashCode()
Serves as the default hash function.
SwimmingStyles
Available swimming styles.