1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| [DefaultProperty("Text"),
ToolboxData("<{0}:Connector runat=server ID=0></{0}:Connector>")]
public class Connector : System.ComponentModel.Component
{
private string _id = string.Empty;
private string _lang = "Fr";
private XmlDocument _source;
private string _sourceFileName = string.Empty;
/// <summary>
///
/// </summary>
public Connector()
{
this._source = new XmlDocument();
}
[
Bindable(false),
Category("Divers"),
DefaultValue(""),
Description("ID de l'élément")
]
public string ID
{
get { return this._id; }
set { this._id = value; }
}
/// <summary>
///
/// </summary>
[Bindable(true),
Category("Connection"),
DefaultValue(true)]
public string Lang
{
get
{
return this._lang;
}
set
{
this._lang = value;
}
}
/// <summary>
///
/// </summary>
[Bindable(true),
Category("Connection"),
DefaultValue(false)]
public string Source
{
get
{
return this._sourceFileName;
}
set
{
this._sourceFileName = value;
this._source.Load(this._sourceFileName);
}
}
/// <summary>
///
/// </summary>
/// <param name="nameObject"></param>
/// <returns></returns>
internal string GetValue(string nameObject)
{
XmlNode obj = this._source.SelectSingleNode("//object[@id='" + nameObject + "']/text[@lang='" + this._lang + "']");
if(obj != null)
return obj.InnerText;
else
return string.Empty;
}
} |
Partager