Exemple #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            List <ConfigurationItem> top = new List <ConfigurationItem>();

            if (itemTypes.Count == 0 && _allowAll)
            {
                itemTypes.Add("Camera");
                itemTypes.Add("Microphone");
                itemTypes.Add("Speaker");
                itemTypes.Add("Input");
                itemTypes.Add("Output");
                itemTypes.Add("Metadata");
            }
            foreach (string itemType in itemTypes)
            {
                List <ConfigurationItem> top2 = _configApiClient.GetTopForItemType(itemType);
                foreach (var newItem in top2)
                {
                    bool found = false;
                    foreach (var currItem in top)
                    {
                        if (currItem.Path == newItem.Path)
                        {
                            found = true;
                        }
                    }
                    if (!found)
                    {
                        top.Add(newItem);
                    }
                }
            }

            MemberPicker picker = new MemberPicker(top, itemTypes, _allowAll, _configApiClient);

            if (picker.ShowDialog() == DialogResult.OK)
            {
                ConfigurationItem selectedItem = picker.SelectedConfigurationItem;
                if (selectedItem != null)
                {
                    listBox1.Items.Add(selectedItem.Path);      // selectedItem.DisplayName;
                }
                else
                if (picker.SelectedAllItem != null)
                {
                    listBox1.Items.Add(picker.SelectedAllItem);
                }
                SaveProperty();
                ValueChanged(this, e);
            }
        }
        private void OnClick(object sender, EventArgs e)
        {
            List <ConfigurationItem> top    = _configApiClient.GetTopForItemType(itemtype);
            MemberPicker             picker = new MemberPicker(top, new List <string>()
            {
                itemtype
            }, false, _configApiClient);

            if (picker.ShowDialog() == DialogResult.OK)
            {
                ConfigurationItem selectedItem = picker.SelectedConfigurationItem;
                if (selectedItem != null)
                {
                    this.Property.Value = selectedItem.Path;
                    button1.Text        = selectedItem.DisplayName;
                }
                else
                {
                    this.Property.Value = null;
                    button1.Text        = "Select a " + itemtype;
                }
                ValueChanged(this, e);
            }
        }