예제 #1
0
 public void ReleaseColor(string groupName)
 {
     if (ColorAssignments.ContainsKey(groupName))
     {
         var count = ColorAssignments[groupName].Count -= 1;
         if (count < 1) ColorAssignments.Remove(groupName);
     }
 }
예제 #2
0
 public Color RequestColor(string groupName)
 {
     if (ColorAssignments.ContainsKey(groupName)) 
     {
         ColorAssignments[groupName].Count++;
         return ColorAssignments[groupName].AssignedColor;
     }
     var assignedColor = GetNextAvailableColor();
     ColorAssignments.Add(groupName, new ColorGroupDetails() { Count = 1, AssignedColor = assignedColor });
     return assignedColor;
 }