Example #1
0
        /// <summary>
        ///  Insert an audio device (= jack) to _AudioDeviceCollection
        ///  If marked as Selected then:
        ///  1. Put the device name in the control window
        ///  2. Mark it as selected in the listview and scroll to it
        /// </summary>
        /// <param name="DevName"> Display name of the device</param>
        /// <param name="levels"> Audio levels as string</param>
        /// <param name="Selected">If true: This is the selected device</param>
        public void Insert_Jack(string JackID, string DevName, uint LLevel, uint RLevel, bool Selected, uint color)
        {
            Color     csColor = Color.FromRgb((byte)((color & 0xff0000) >> 0x10), (byte)((color & 0xff00) >> 8), (byte)(color & 0xff));
            AudioLine item    = new AudioLine {
                ID = JackID, DeviceName = DevName, LevelLeft = LLevel, LevelRight = RLevel, EmptyStr = "-", Fill = new SolidColorBrush(csColor)
            };

            _event._AudioDeviceCollection.Add(item);

            if (Selected)
            {
                _event.SelectedJack = item;
                int index = _event._AudioDeviceCollection.IndexOf(item);
                Audio_LB.SelectedIndex = index;
                Audio_LB.ScrollIntoView(Audio_LB.SelectedItem);
                ListViewItem lvitem = Audio_LB.ItemContainerGenerator.ContainerFromItem(index) as ListViewItem;
                if (lvitem != null)
                {
                    lvitem.Focus();
                }
            }
            ;
        }
        /// <summary>
        ///  Insert an audio device (= jack) to _AudioDeviceCollection
        ///  If marked as Selected then:
        ///  1. Put the device name in the control window
        ///  2. Mark it as selected in the listview and scroll to it
        /// </summary>
        /// <param name="DevName"> Display name of the device</param>
        /// <param name="levels"> Audio levels as string</param>
        /// <param name="Selected">If true: This is the selected device</param>
        public void Insert_Jack(string JackID, string DevName, uint LLevel, uint RLevel, bool Selected, uint color)
        {
            Color csColor = Color.FromRgb((byte)((color & 0xff0000) >> 0x10), (byte)((color & 0xff00) >> 8), (byte)(color & 0xff));
            AudioLine item = new AudioLine { ID = JackID, DeviceName = DevName, LevelLeft = LLevel, LevelRight = RLevel, EmptyStr = "-", Fill = new SolidColorBrush(csColor) };
            _event._AudioDeviceCollection.Add(item);

            if (Selected)
            {
                _event.SelectedJack = item;
                int index = _event._AudioDeviceCollection.IndexOf(item);
                Audio_LB.SelectedIndex = index;
                Audio_LB.ScrollIntoView(Audio_LB.SelectedItem);
                ListViewItem lvitem = Audio_LB.ItemContainerGenerator.ContainerFromItem(index) as ListViewItem;
                if (lvitem != null)
                    lvitem.Focus();
            };
        }