2018-07-05 13:33:08 -07:00
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
using DICUI.Data;
|
|
|
|
|
|
using DICUI.Utilities;
|
|
|
|
|
|
|
2018-10-08 11:06:22 -07:00
|
|
|
|
namespace DICUI
|
2018-07-05 13:33:08 -07:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents a single item in the System combo box
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class KnownSystemComboBoxItem
|
|
|
|
|
|
{
|
|
|
|
|
|
private object data;
|
|
|
|
|
|
|
|
|
|
|
|
public KnownSystemComboBoxItem(KnownSystem? system) => data = system;
|
|
|
|
|
|
public KnownSystemComboBoxItem(KnownSystemCategory? category) => data = category;
|
|
|
|
|
|
|
|
|
|
|
|
public Brush Foreground { get => IsHeader() ? Brushes.Gray : Brushes.Black; }
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsHeader() => data is KnownSystemCategory?;
|
|
|
|
|
|
public bool IsSystem() => data is KnownSystem?;
|
|
|
|
|
|
|
|
|
|
|
|
public static implicit operator KnownSystem? (KnownSystemComboBoxItem item) => item.data as KnownSystem?;
|
|
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
if (IsHeader())
|
2019-05-20 22:14:53 -07:00
|
|
|
|
return "---------- " + (data as KnownSystemCategory?).LongName() + " ----------";
|
2018-07-05 13:33:08 -07:00
|
|
|
|
else
|
2019-05-20 22:14:53 -07:00
|
|
|
|
return (data as KnownSystem?).LongName();
|
2018-07-05 13:33:08 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|