Beispiel #1
0
        /// <summary>
        /// Build up "itemsList" for the write action, using their name as the identifier.
        /// </summary>
        private ItemValue[] PrepareControlValueItemList()
        {
            var itemsList = new List <ItemValue>(OpcController.Subscription.Items.Count());

            foreach (var item in OpcController.Subscription.Items)
            {
                for (var i = 0; i <= 3; i++)
                {
                    var topic = FindControlByName("TopictextBox", i, this).Text;
                    var name  = FindControlByName("ItemtextBox", i, this).Text;
                    var value = FindControlByName("ValuetextBox", i, this).Text;

                    var tag = new RSOpcTag(topic, name);

                    if (tag.ToString() != item.ItemName)
                    {
                        continue;
                    }

                    itemsList.Add(new Opc.Da.ItemValue(item)
                    {
                        Value = value,
                    });
                }
            }
            return(itemsList.ToArray());
        }
Beispiel #2
0
        /// <summary>
        /// Write the values into the control for the read action, using their name as the identifier.
        /// </summary>
        /// <param name="values"></param>
        private void WriteControlValues(IEnumerable <ItemValueResult> values)
        {
            foreach (var result in values)
            {
                for (var i = 0; i <= 3; i++)
                {
                    var topic = FindControlByName("TopictextBox", i, this).Text;
                    var item  = FindControlByName("ItemtextBox", i, this).Text;

                    var tag = new RSOpcTag(topic, item);

                    var itemName = tag.ToString();
                    if (itemName != result.ItemName)
                    {
                        continue;
                    }

                    FindControlByName("ValuetextBox", i, this).Text   = result.Value.ToString();
                    FindControlByName("QualitytextBox", i, this).Text = OpcClient.ResultToString(result);
                }
            }
        }