コード例 #1
0
        private void ListProducts()
        {
            infoControls.comType         = commandType.read;
            infoControls.requestDataType = RequestDataType.products;
            DataTypeComStatus allowProtocol = dataExchange.DataExchangeProtocol(infoControls);

            if (allowProtocol == DataTypeComStatus.readableProducts)
            {
                Product product = new Product();
                dataCollection = dataExchange.GetData <Product>();
                if (dataCollection != null)
                {
                    foreach (KeyValuePair <int, Product> KeyValuePairProduct in dataCollection)
                    {
                        productData = KeyValuePairProduct.Value;
                        string[] row =
                        {
                            productData.ProductName.Value,   productData.LabelName.Value, productData.Cable1Color.Value,
                            productData.Cable2Color.Value,   productData.Quantity.Value,  productData.CableSection.Value,
                            productData.CableDiameter.Value, productData.CableDirection.Value
                        };
                        var lvi = new ListViewItem(row);
                        listView_Products.Items.Add(lvi);
                    }
                }
            }
        }