| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- using System.Xml;
- namespace System.Net.HomeMatic {
- public class HMProgram : HMElement {
-
- private int _id;
- private string _name;
- private bool _active;
- private int _timestamp;
- private string _description;
- private bool _visible;
- private bool _operate;
-
- public HMProgram(HMApi Api) : base(Api) {
- }
- public HMProgram(HMApi Api, XmlNode Data) : base(Api) {
- this.Init(Data);
- }
- private void Init(XmlNode Data) {
- this._id = this.Attr_Int32(Data, "id");
- this._name = this.Attr_String(Data, "name");
- this._active = this.Attr_Bool(Data, "active");
- this._timestamp = this.Attr_Int32(Data, "timestamp");
- this._description = this.Attr_String(Data, "description");
- this._visible = this.Attr_Bool(Data, "visible");
- this._operate = this.Attr_Bool(Data, "operate");
- }
- public int ID {
- get { return this._id; }
- }
- public string Name {
- get { return this._name; }
- }
- public bool Active {
- get { return this._active; }
- }
- public int TimeStamp {
- get { return this._timestamp; }
- }
- public string Description {
- get { return this._description; }
- }
- public bool Visible {
- get { return this._visible; }
- }
- public bool Operate {
- get { return this._operate; }
- }
- public void Run() {
- this._api.GetApiData(ApiMethode.RunProgram, new Collections.Generic.Dictionary<string, object>() {
- ["program_id"] = this._id
- });
- }
- /*public override bool Equals(object o) {
- if (o == null) return false;
- if (((HMProgram)o).ID == this._id)
- return true;
- else
- return false;
- }
- public static bool operator ==(HMProgram c1, HMProgram c2) {
- if (c1 == null || c2 == null) return c1 == null && c2 == null;
- return c1.Equals(c2);
- }
- public static bool operator !=(HMProgram c1, HMProgram c2) {
- if (c1 == null || c2 == null) return (c1 != null || c2 != null);
- return !c1.Equals(c2);
- }*/
- public override string ToString() {
- return "[System.Net.HomeMatic.HMProgram[" + this.ValuesToString() + "]]";
- }
- private string ValuesToString() {
- return this._id.ToString() + ";" +
- this._name + ";" +
- (this._active ? "true" : "false") + ";" +
- this._timestamp.ToString() + ";" +
- this._description + ";" +
- (this._visible ? "true" : "false") + ";" +
- (this._operate ? "true" : "false") + ";";
- }
- public override int GetHashCode() {
- return this.ToString().GetHashCode();
- }
- }
- }
|