コード例 #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;
 }