Beispiel #1
0
        /// <summary>
        /// Updates the array list view with the current array elements.
        /// </summary>
        private new void Update()
        {
            m_index = -1;
            ValueCTRL.Set(null, m_readOnly);
            ArrayLV.Items.Clear();

            int index = 0;

            foreach (object element in (Array)m_value)
            {
                string[] columns = new string[]
                {
                    String.Format("[{0}]", index++),
                    Technosoftware.DaAeHdaClient.OpcConvert.ToString(element)
                };

                ListViewItem item = new ListViewItem(columns, Resources.IMAGE_YELLOW_SCROLL);
                item.Tag = element;

                ArrayLV.Items.Add(item);
            }

            // select the first item.
            if (ArrayLV.Items.Count > 0)
            {
                ArrayLV.Items[0].Selected = true;
            }
        }
        /// <summary>
        /// Displays the dialog with the specified array.
        /// </summary>
        public object ShowDialog(object value, bool fixedType)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }
            if (value.GetType().IsArray)
            {
                throw new ArgumentException("Is an array", "value");
            }

            m_value = Technosoftware.DaAeHdaClient.OpcConvert.Clone(value);
            m_type  = m_value.GetType();

            ValueCTRL.AllowChangeType = !fixedType;
            ValueCTRL.Set(value, false);

            if (ShowDialog() != DialogResult.OK)
            {
                return(null);
            }

            return(ValueCTRL.Get());
        }