using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Linq; using System.Text; using Deltares.Standard; using Deltares.Standard.Attributes; using Deltares.Standard.EventPublisher; namespace Deltares.Dam.Data { public class RWResult : IVisibleEnabled { private RWResultType _rwResultType = RWResultType.ProbabilityOfFailure; private double safetyFactor = -1; private double probabilityOfFailure = -1; private CalculationResult calculationResult = CalculationResult.NoRun; private ResultEvaluation resultEvaluation = ResultEvaluation.NotEvaluated; private string notes = ""; public const string ResultCategory = "Results"; public RWResult() { } [Browsable(false)] [Label("Result type")] public virtual RWResultType RwResultType { get { return _rwResultType; } set { _rwResultType = value; } } [ReadOnly(true)] [Label("Safety factor")] [Format("F3")] [PropertyOrder(1, 1)] [Category(ResultCategory)] public virtual double SafetyFactor { get { return safetyFactor; } set { safetyFactor = value; } } [ReadOnly(true)] [Label("Probability of failure")] [Format("F3")] [PropertyOrder(1, 2)] [Category(ResultCategory)] public virtual double ProbabilityOfFailure { get { return probabilityOfFailure; } set { probabilityOfFailure = value; } } [ReadOnly(true)] [Label("Calculation result")] [PropertyOrder(1,0)] [Category(ResultCategory)] public virtual CalculationResult CalculationResult { get { return calculationResult; } set { calculationResult = value; } } [Label("Evaluation")] [PropertyOrder(5, 1)] [Category(ResultCategory)] public ResultEvaluation ResultEvaluation { get { return resultEvaluation; } set { DataEventPublisher.BeforeChange(this, "ResultEvaluation"); resultEvaluation = value; DataEventPublisher.AfterChange(this, "ResultEvaluation"); } } [Label("Notes")] [Description("Use this area to explain the valuation and for any further remarks")] [PropertyOrder(5, 2)] [Category(ResultCategory)] public string Notes { get { return notes; } set { DataEventPublisher.BeforeChange(this, "Notes"); notes = value; DataEventPublisher.AfterChange(this, "Notes"); } } #region IVisibleEnabled Members public bool IsEnabled(string property) { return true; } public bool IsVisible(string property) { switch (property) { case "SafetyFactor": return RwResultType == RWResultType.SafetyFactor; case "ProbabilityOfFailure": return RwResultType == RWResultType.ProbabilityOfFailure; default : return true; } } #endregion } }