2015-12-20 10:17:26 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2015-06-04 13:15:54 -04:00
|
|
|
|
using System.Windows.Media;
|
2015-06-24 14:57:16 -04:00
|
|
|
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
2015-12-20 10:17:26 -05:00
|
|
|
|
using Filtration.ObjectModel.Enums;
|
2015-06-04 13:15:54 -04:00
|
|
|
|
|
2015-06-24 14:57:16 -04:00
|
|
|
|
namespace Filtration.ObjectModel.BlockItemTypes
|
2015-06-04 13:15:54 -04:00
|
|
|
|
{
|
2015-06-24 14:57:16 -04:00
|
|
|
|
public class SocketGroupBlockItem : StringListBlockItem
|
2015-06-04 13:15:54 -04:00
|
|
|
|
{
|
2015-12-20 10:17:26 -05:00
|
|
|
|
public SocketGroupBlockItem()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-13 15:17:15 -05:00
|
|
|
|
public override string PrefixText => "SocketGroup";
|
|
|
|
|
public override int MaximumAllowed => 1;
|
|
|
|
|
public override string DisplayHeading => "Socket Group";
|
2015-06-04 13:15:54 -04:00
|
|
|
|
public override string SummaryText
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
var summaryItemText = " " + Items.Aggregate(string.Empty, (current, i) => current + " " + i);
|
|
|
|
|
return "Socket Group " + summaryItemText.TrimStart(' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-12-20 10:17:26 -05:00
|
|
|
|
|
|
|
|
|
public IEnumerable<SocketGroup> SocketGroups
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return
|
|
|
|
|
Items.Select(socketGroup => socketGroup.Select(socketChar => new Socket(StringToSocketColor(socketChar))).ToList())
|
|
|
|
|
.Select(socketList => new SocketGroup(socketList, true))
|
|
|
|
|
.ToList();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-13 15:17:15 -05:00
|
|
|
|
public override Color SummaryBackgroundColor => Colors.GhostWhite;
|
|
|
|
|
public override Color SummaryTextColor => Colors.Black;
|
|
|
|
|
public override int SortOrder => 9;
|
2015-12-20 10:17:26 -05:00
|
|
|
|
|
|
|
|
|
private SocketColor StringToSocketColor(char socketColorString)
|
|
|
|
|
{
|
|
|
|
|
switch (socketColorString)
|
|
|
|
|
{
|
|
|
|
|
case 'R':
|
|
|
|
|
{
|
|
|
|
|
return SocketColor.Red;
|
|
|
|
|
}
|
|
|
|
|
case 'G':
|
|
|
|
|
{
|
|
|
|
|
return SocketColor.Green;
|
|
|
|
|
}
|
|
|
|
|
case 'B':
|
|
|
|
|
{
|
|
|
|
|
return SocketColor.Blue;
|
|
|
|
|
}
|
|
|
|
|
case 'W':
|
|
|
|
|
{
|
|
|
|
|
return SocketColor.White;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
throw new InvalidOperationException("Invalid socket color");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-04 13:15:54 -04:00
|
|
|
|
}
|
|
|
|
|
}
|