cs1 improvements
This commit is contained in:
@@ -59,7 +59,7 @@ namespace PoloClubApp {
|
||||
/// </summary>
|
||||
/// <returns>True if assigned, false otherwise.</returns>
|
||||
public bool IsAssigned(){
|
||||
return !string.IsNullOrEmpty(PlayerName);
|
||||
return !string.IsNullOrEmpty(PlayerName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,17 +68,16 @@ namespace PoloClubApp {
|
||||
/// <param name="playerName">Name of the player to assign to.</param>
|
||||
/// <param name="waterResistanceMeters">Water resistance for wearables (nullable).</param>
|
||||
/// <exception cref="Exception">Throws when assignment fails.</exception>
|
||||
public void AssignDevice(string playerName, int? waterResistanceMeters)
|
||||
{
|
||||
if (IsAssigned())
|
||||
public void AssignDevice(string playerName, int? waterResistanceMeters){
|
||||
if (IsAssigned()){
|
||||
throw new Exception("Device is already assigned");
|
||||
|
||||
if (this is IWearable && waterResistanceMeters < 3)
|
||||
}
|
||||
if (this is IWearable && waterResistanceMeters < 3){
|
||||
throw new Exception("Water resistance must be 3 meters or more for wearables");
|
||||
|
||||
if (Id == 0)
|
||||
}
|
||||
if (Id == 0){
|
||||
throw new Exception("Invalid device ID");
|
||||
|
||||
}
|
||||
PlayerName = playerName;
|
||||
}
|
||||
|
||||
@@ -87,11 +86,11 @@ namespace PoloClubApp {
|
||||
/// </summary>
|
||||
/// <returns>True if successful, false if device wasn't assigned.</returns>
|
||||
public bool ReturnDevice(){
|
||||
if (!IsAssigned())
|
||||
return false;
|
||||
|
||||
PlayerName = null;
|
||||
return true;
|
||||
if (!IsAssigned()){
|
||||
return false;
|
||||
}
|
||||
PlayerName = null;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user