/*
* DTS.Slice.Control.ReviewableAttribute.cs
*
* Copyright © 2009
* Diversified Technical Systems, Inc.
* All Rights Reserved
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTS.Utilities;
using DTS.Utilities.DotNetProgrammingConstructs;
namespace DTS.Slice.Control
{
///
/// Representation of a "reviewable" attribute.
///
abstract public class ReviewableAttribute : Exceptional
{ ///
///
/// Initialize an instance of the ReviewableAttribute class.
///
///
///
/// The name of the attribute represented by this object.
///
///
///
/// The value of the attribute represented by this object.
///
///
public ReviewableAttribute(string name, DetermineValueString calculateValue)
{
try
{
this.Name = name;
this.CalculateValue = calculateValue;
}
catch (System.Exception ex)
{
throw new ReviewableAttribute.Exception("encountered problem constructing " + this.GetType().FullName, ex);
}
}
///
/// The name associated with this review tab-displayable attribute.
///
public string Name
{
get { return _Name.Value; }
private set { _Name.Value = value; }
}
private Property _Name
= new Property(
typeof(ReviewableAttribute).Namespace + ".ReviewableAttribute.Name",
null,
false
);
///
/// Get the value for this attribute.
///
public string Value
{
get
{
try
{
return CalculateValue();
}
catch (System.Exception ex)
{
Utilities.Logging.APILogger.Log("encountered problem getting ReviewableAttribute value", ex);
return "N/A";
//throw new ReviewableAttribute.Exception( "encountered problem getting ReviewableAttribute value", ex );
}
}
}
// Need to attach the list of attribute "accessors" to the channel in a similar way
// we do with filters. Have an "available" list. And then an "active" list.
public delegate string DetermineValueString();
///
/// Determine the value associated with this review tab-displayable attribute.
///
private DetermineValueString CalculateValue
{
get
{
try
{
if (!_CalculateValueIsInitialized)
throw new ApplicationException("method property \"CalculateValue\" has not been initialized");
else return _CalculateValue;
}
catch (System.Exception ex)
{
throw new ReviewableAttribute.Exception("encountered problem getting property value", ex);
}
}
set
{
_CalculateValue = value;
_CalculateValueIsInitialized = true;
}
}
private DetermineValueString _CalculateValue;
private bool _CalculateValueIsInitialized = false;
}
}