using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace QC.QTMInterface.Business_Objects;

public class AttributeObservableCollection : ObservableCollection<AttributeValue>
{
	private bool _updating;

	public bool Updating
	{
		get
		{
			return _updating;
		}
		set
		{
			if (_updating != value)
			{
				_updating = value;
				OnCollectionChanged(null);
			}
		}
	}

	public AttributeObservableCollection(IEnumerable<AttributeValue> collection)
		: base(collection)
	{
	}

	public AttributeObservableCollection(List<AttributeValue> list)
		: base(list)
	{
	}

	public AttributeObservableCollection()
	{
	}

	public override string ToString()
	{
		if (base.Count == 0)
		{
			return "None";
		}
		string text = string.Empty;
		foreach (AttributeValue item in this.OrderBy((AttributeValue p) => p.Value))
		{
			text = text + item.Value + ", ";
		}
		if (text.Length > 2)
		{
			text = text.Remove(text.Length - 2, 2);
		}
		return text;
	}
}
