예제 #1
0
        private void mpButtonUnmap_Click(object sender, EventArgs e)
        {
            NotifyForm dlg = new NotifyForm("Unmapping selected channels from TV-Card...",
                                            "This can take some time\n\nPlease be patient...");

            dlg.Show(this);
            dlg.WaitForDisplay();
            mpListViewChannels.BeginUpdate();
            mpListViewMapped.BeginUpdate();

            try
            {
                ListView.SelectedListViewItemCollection selectedItems = mpListViewMapped.SelectedItems;

                foreach (ListViewItem item in selectedItems)
                {
                    ChannelMap map = (ChannelMap)item.Tag;
                    mpListViewMapped.Items.Remove(item);
                    Channel      referencedChannel = map.ReferencedChannel();
                    ListViewItem newItem           = mpListViewChannels.Items.Add(referencedChannel.DisplayName, item.ImageIndex);
                    newItem.Tag = referencedChannel;
                    map.Remove();
                }
                mpListViewChannels.Sort();
                mpListViewMapped.Sort();
                dlg.Close();
            }
            finally
            {
                mpListViewChannels.EndUpdate();
                mpListViewMapped.EndUpdate();
            }
            // DatabaseManager.Instance.SaveChanges();
        }
예제 #2
0
        private void mpListViewMapped_DoubleClick(object sender, EventArgs e)
        {
            if (mpListViewMapped.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem item    = mpListViewMapped.SelectedItems[0];
            ChannelMap   map     = (ChannelMap)item.Tag;
            Channel      channel = map.ReferencedChannel();

            if (map.EpgOnly)
            {
                item.Text   = channel.DisplayName;
                map.EpgOnly = false;
            }
            else
            {
                item.Text   = channel.DisplayName + " (EPG Only)";
                map.EpgOnly = true;
            }
            map.Persist();
        }