2015-06-11 22:01:52 +01:00
|
|
|
|
using System;
|
2015-06-18 21:08:44 +01:00
|
|
|
|
using System.Collections.Generic;
|
2015-06-08 20:17:34 +01:00
|
|
|
|
|
|
|
|
|
namespace Filtration.Models
|
|
|
|
|
{
|
2015-06-18 21:08:44 +01:00
|
|
|
|
internal class ItemFilterBlockGroup
|
2015-06-08 20:17:34 +01:00
|
|
|
|
{
|
2015-06-18 21:08:44 +01:00
|
|
|
|
private bool _isChecked;
|
2015-06-11 21:01:33 +01:00
|
|
|
|
|
2015-06-14 19:17:39 +01:00
|
|
|
|
public ItemFilterBlockGroup(string groupName, ItemFilterBlockGroup parent, bool advanced = false)
|
2015-06-08 22:29:39 +01:00
|
|
|
|
{
|
|
|
|
|
GroupName = groupName;
|
|
|
|
|
ParentGroup = parent;
|
2015-06-14 19:17:39 +01:00
|
|
|
|
Advanced = advanced;
|
2015-06-18 21:08:44 +01:00
|
|
|
|
ChildGroups = new List<ItemFilterBlockGroup>();
|
2015-06-08 22:29:39 +01:00
|
|
|
|
}
|
2015-06-18 21:08:44 +01:00
|
|
|
|
|
2015-06-11 22:01:52 +01:00
|
|
|
|
public event EventHandler BlockGroupStatusChanged;
|
2015-06-18 21:08:44 +01:00
|
|
|
|
|
2015-06-11 22:01:52 +01:00
|
|
|
|
public string GroupName { get; private set; }
|
|
|
|
|
public ItemFilterBlockGroup ParentGroup { get; private set; }
|
2015-06-18 21:08:44 +01:00
|
|
|
|
public List<ItemFilterBlockGroup> ChildGroups { get; private set; }
|
2015-06-14 19:17:39 +01:00
|
|
|
|
public bool Advanced { get; private set; }
|
|
|
|
|
|
2015-06-18 21:08:44 +01:00
|
|
|
|
public bool IsChecked
|
2015-06-11 21:01:33 +01:00
|
|
|
|
{
|
2015-06-18 21:08:44 +01:00
|
|
|
|
get { return _isChecked; }
|
2015-06-11 21:01:33 +01:00
|
|
|
|
set
|
|
|
|
|
{
|
2015-06-18 21:08:44 +01:00
|
|
|
|
if (value != _isChecked)
|
2015-06-11 21:01:33 +01:00
|
|
|
|
{
|
|
|
|
|
_isChecked = value;
|
2015-06-11 22:01:52 +01:00
|
|
|
|
// Raise an event to let blocks that have this block group assigned that
|
|
|
|
|
// they might need to change their Action due to the block group status changing.
|
|
|
|
|
if (BlockGroupStatusChanged != null)
|
|
|
|
|
{
|
|
|
|
|
BlockGroupStatusChanged.Invoke(null, null);
|
|
|
|
|
}
|
2015-06-11 21:01:33 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-18 21:08:44 +01:00
|
|
|
|
public override string ToString()
|
2015-06-14 19:17:39 +01:00
|
|
|
|
{
|
2015-06-18 21:08:44 +01:00
|
|
|
|
var currentBlockGroup = this;
|
2015-06-14 19:17:39 +01:00
|
|
|
|
|
2015-06-18 21:08:44 +01:00
|
|
|
|
var outputString = GroupName;
|
2015-06-14 19:17:39 +01:00
|
|
|
|
|
2015-06-18 21:08:44 +01:00
|
|
|
|
// TODO: This is retarded, fix this.
|
|
|
|
|
if (currentBlockGroup.ParentGroup != null)
|
2015-06-14 19:17:39 +01:00
|
|
|
|
{
|
2015-06-18 21:08:44 +01:00
|
|
|
|
while (currentBlockGroup.ParentGroup.ParentGroup != null)
|
|
|
|
|
{
|
|
|
|
|
outputString = currentBlockGroup.ParentGroup.GroupName + " - " + outputString;
|
|
|
|
|
currentBlockGroup = currentBlockGroup.ParentGroup;
|
|
|
|
|
}
|
2015-06-14 19:17:39 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-06-18 21:08:44 +01:00
|
|
|
|
return outputString;
|
2015-06-11 21:01:33 +01:00
|
|
|
|
}
|
2015-06-08 20:17:34 +01:00
|
|
|
|
}
|
|
|
|
|
}
|