public override plcdb_lib.Models.Model.TagsDataTable BrowseTags() { try { Model.TagsDataTable Table = new Model.TagsDataTable(); if (Server == null) { return(Table); } ServerAddressSpaceBrowser Browser = Server.GetAddressSpaceBrowser(); foreach (String ItemId in Browser.GetItemIds(BrowseType.Flat, string.Empty, VarEnum.VT_EMPTY, 0)) { Model.TagsRow Row = Table.NewTagsRow(); Row.Address = ItemId; Row.Controller = ControllerInfo.PK; Table.AddTagsRow(Row); } Table.AcceptChanges(); return(Table); } catch (Exception ex) { throw new Exception("Error browsing tags from OPC server: " + ControllerInfo.Address + "\\" + ControllerInfo.opc_server, ex); } }
public override Model.TagsDataTable BrowseTags() { if (Tags == null) { Tags = new Model.TagsDataTable(); Model.TagsRow Sine = Tags.NewTagsRow(); Sine.Address = "Doubles\\Sine"; Sine.Name = Sine.Address; Sine.DataType = typeof(Double); Sine.Controller = ControllerInfo.PK; Model.TagsRow Rand = Tags.NewTagsRow(); Rand.Address = "Doubles\\Rand"; Rand.Name = Rand.Address; Rand.DataType = typeof(Double); Rand.Controller = ControllerInfo.PK; Model.TagsRow AlwaysOn = Tags.NewTagsRow(); AlwaysOn.Address = "Bools\\AlwaysOn"; AlwaysOn.Name = AlwaysOn.Address; AlwaysOn.DataType = typeof(Boolean); AlwaysOn.Controller = ControllerInfo.PK; Model.TagsRow AlwaysOff = Tags.NewTagsRow(); AlwaysOff.Address = "Bools\\AlwaysOff"; AlwaysOff.Name = AlwaysOff.Address; AlwaysOff.DataType = typeof(Boolean); AlwaysOff.Controller = ControllerInfo.PK; Model.TagsRow RandBool = Tags.NewTagsRow(); RandBool.Address = "Bools\\RandBool"; RandBool.Name = RandBool.Address; RandBool.DataType = typeof(Boolean); RandBool.Controller = ControllerInfo.PK; Model.TagsRow Now = Tags.NewTagsRow(); Now.Address = "DateTimes\\Now"; Now.Name = Now.Address; Now.DataType = typeof(DateTime); Now.Controller = ControllerInfo.PK; Tags.AddTagsRow(Sine); Tags.AddTagsRow(Rand); Tags.AddTagsRow(AlwaysOn); Tags.AddTagsRow(AlwaysOff); Tags.AddTagsRow(RandBool); Tags.AddTagsRow(Now); } return(Tags); }