using System; using JD.Kernel.StaticHelpers; namespace JD.TeaBoxAddinSystem.Addins.Description.Conditions { /// /// Describes a condition and its target. /// public class ConditionInfo : AddinObject { #region Variables private readonly Condition m_condition; private string m_target; #endregion #region Constructor /// /// Constructor. /// /// public ConditionInfo(Condition condition) { Throw.IfNull(condition, "condition"); m_condition = condition; } /// /// Constructor. /// /// /// public ConditionInfo(Condition condition, string target) : this(condition) { Target = target; } #endregion #region Properties /// /// Condition. /// public Condition Condition { get { return m_condition; } } /// /// Target to apply the condition to. /// public string Target { get { return m_target; } set { ThrowIfLoaded(); m_target = value; } } #endregion #region Methods internal override void OnModuleChanged(EventArgs e) { Condition.Module = Module; base.OnModuleChanged(e); } /// /// Overriden. /// /// public override string ToString() { return $"[ConditionInfo: Condition={Condition} Target={(string.IsNullOrEmpty(Target) ? "None" : Target)}]"; } #endregion } }