Esempio n. 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();
        }
Esempio n. 2
0
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            Card card = (Card)mpListView1.SelectedItems[0].Tag;

            DialogResult res = MessageBox.Show(this,
                                               "Are you sure you want to delete this card along with all the channel mappings? (channels will not be deleted)",
                                               "Delete card?", MessageBoxButtons.YesNo);

            if (res == DialogResult.Yes)
            {
                if (card.ReferringCardGroupMap().Count > 0)
                {
                    for (int i = card.ReferringCardGroupMap().Count - 1; i > -1; i--)
                    {
                        CardGroupMap map = card.ReferringCardGroupMap()[i];
                        map.Remove();
                    }
                }

                if (card.ReferringChannelMap().Count > 0)
                {
                    for (int i = card.ReferringChannelMap().Count - 1; i > -1; i--)
                    {
                        ChannelMap map = card.ReferringChannelMap()[i];
                        map.Remove();
                    }
                }

                RemoteControl.Instance.CardRemove(card.IdCard);
                mpListView1.Items.Remove(mpListView1.SelectedItems[0]);
                _needRestart = true;
            }
        }