|
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.ComponentModel;
using HybridProperty;
namespace Attributes
{
public enum AttributeMode
{
Text,
Data,
Error,
Formulae,
Code
};
[Serializable]
[TypeConverter(typeof(AttributeConverter))]
public class Attribute<Type>
{
#region attributes
private string _name;
private Type _value;
private string _formulae;
private string _textvalue;
private ArrayList _source;
private bool _isvisible = true;
private string _code;
private AttributeMode _mode = AttributeMode.Text;
#endregion
#region Constructors
public Attribute()
{
_source = new ArrayList();
_textvalue = "";
}
public Attribute(string name)
:this()
{
this._name = name;
}
public Attribute(string name, Type value)
:this(name)
{
this._value = value;
this._mode = AttributeMode.Data;
}
public Attribute(string name, Type value,bool isvisible)
: this(name,value)
{
this._isvisible = isvisible;
}
#endregion
#region properties
public string Name
{
get { return _name; }
set { _name = value; }
}
public Type Value
{
get { return _value; }
set { _value = value; }
}
public string Formulae
{
get { return _formulae; }
set { _formulae = value; }
}
public string Text
{
get { return _textvalue; }
set { _textvalue = value; }
}
public bool Visible
{
get { return _isvisible; }
set { _isvisible = value; }
}
public ArrayList DataSource
{
get { return _source; }
set { _source = value; }
}
public string Code
{
get { return _code; }
set { _code = value; }
}
public AttributeMode Mode
{
get { return _mode; }
set { _mode = value; }
}
#endregion
public override string ToString()
{
switch (_mode)
{
case AttributeMode.Code:
case AttributeMode.Data:
return _value.ToString();
break;
case AttributeMode.Formulae:
return _formulae;
break;
case AttributeMode.Text:
case AttributeMode.Error:
return _textvalue;
break;
default:
return _textvalue;
break;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.