public void RefreshList(IChannelFactory factory)
        {
            List<ListViewItem> removeItems = new List<ListViewItem>();
            foreach (ChannelListViewItem item in Items) {
                if (item.DynamicChannel) {
                    if (item.IsListening) {
                        item.StopListening();
                    }

                    removeItems.Add(item);
                }
            }

            foreach (ListViewItem item in removeItems) {
                Items.Remove(item);
            }

            ICollection<string> channels = null;
            try {
                channels = factory.Channels;
            }
            catch (Exception ex) {
                MessageBox.Show(this.FindForm(), "Could not get channels from channel factory:\n" + ex.Message, "Car Browser", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            List<ChannelListViewItem> items = new List<ChannelListViewItem>();
            foreach (string name in channels) {
                try {
                    IChannel channel = factory.GetChannel(name, ChannelMode.Bytestream);
                    ChannelListViewItem item = new ChannelListViewItem(channel, this);

                    items.Add(item);
                }
                catch (Exception) {
                }
            }

            Items.AddRange(items.ToArray());
        }
        public void SetStaticChannels(List<ChannelConfig> staticChannels)
        {
            List<ListViewItem> removeItems = new List<ListViewItem>();
            foreach (ChannelListViewItem item in Items) {
                if (!item.DynamicChannel) {
                    if (item.IsListening) {
                        item.StopListening();
                    }

                    removeItems.Add(item);
                }
            }

            foreach (ListViewItem item in removeItems) {
                Items.Remove(item);
            }

            List<ChannelListViewItem> items = new List<ChannelListViewItem>();
            foreach (ChannelConfig channel in staticChannels) {
                try {
                    IPAddress channelAddress = IPAddress.Parse(channel.address);
                    IPEndPoint endpoint = new IPEndPoint(channelAddress, channel.port);
                    ChannelListViewItem item = new ChannelListViewItem(channel.name, endpoint, channel.channelType, this);

                    items.Add(item);
                }
                catch (Exception) {
                }
            }

            Items.AddRange(items.ToArray());
        }