private void OnAddToFavoritesMenuItem_Click(object sender, EventArgs e)
        {
            RadioChannelGroup group;
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;

            if (menuItem.Tag == null)
            {
                GroupNameForm dlg = new GroupNameForm();
                dlg.IsRadio = true;
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                group = new RadioChannelGroup(dlg.GroupName, 9999);
                group.Persist();

                this.RefreshContextMenu();
                this.RefreshTabs();
            }
            else
            {
                group = (RadioChannelGroup)menuItem.Tag;
            }

            ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
            if (indexes.Count == 0)
            {
                return;
            }
            TvBusinessLayer layer = new TvBusinessLayer();

            for (int i = 0; i < indexes.Count; ++i)
            {
                ListViewItem item = mpListView1.Items[indexes[i]];

                Channel channel = (Channel)item.Tag;
                layer.AddChannelToRadioGroup(channel, group);

                IList <string> groups     = channel.GroupNames;
                List <string>  groupNames = new List <string>();
                foreach (string groupName in groups)
                {
                    if (groupName != TvConstants.TvGroupNames.AllChannels &&
                        groupName != TvConstants.RadioGroupNames.AllChannels)
                    {
                        //Don't add "All Channels"
                        groupNames.Add(groupName);
                    }
                }
                item.SubItems[2].Text = String.Join(", ", groupNames.ToArray());
            }

            mpListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Example #2
0
        private void OnAddToFavoritesMenuItem_Click(object sender, EventArgs e)
        {
            RadioChannelGroup group;
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;

            if (menuItem.Tag == null)
            {
                GroupNameForm dlg = new GroupNameForm();
                dlg.IsRadio = true;
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                group = new RadioChannelGroup(dlg.GroupName, 9999);
                group.Persist();

                this.RefreshContextMenu();
                this.RefreshTabs();
            }
            else
            {
                group = (RadioChannelGroup)menuItem.Tag;
            }

            ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
            if (indexes.Count == 0)
            {
                return;
            }
            TvBusinessLayer layer = new TvBusinessLayer();

            for (int i = 0; i < indexes.Count; ++i)
            {
                ListViewItem item = mpListView1.Items[indexes[i]];

                Channel channel = (Channel)item.Tag;
                layer.AddChannelToRadioGroup(channel, group);

                string groupString = item.SubItems[1].Text;
                if (groupString == string.Empty)
                {
                    groupString = group.GroupName;
                }
                else
                {
                    groupString += ", " + group.GroupName;
                }

                item.SubItems[1].Text = groupString;
            }

            mpListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Example #3
0
        private void mpButtonAddGroup_Click(object sender, EventArgs e)
        {
            GroupNameForm dlg = new GroupNameForm();

            if (dlg.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            ChannelGroup group = new ChannelGroup(dlg.GroupName, 9999);

            group.Persist();

            this.RefreshContextMenu();
            this.RefreshTabs();
        }
Example #4
0
        private void renameGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripDropDownItem menuItem = sender as ToolStripDropDownItem;

            if (menuItem == null)
            {
                return;
            }

            TabPage tab = menuItem.Tag as TabPage;

            if (tab == null)
            {
                return;
            }

            ChannelGroup group = tab.Tag as ChannelGroup;

            if (group == null)
            {
                return;
            }

            GroupNameForm dlg = new GroupNameForm(group.GroupName);

            dlg.ShowDialog(this);

            if (dlg.GroupName.Length == 0)
            {
                return;
            }

            group.GroupName = dlg.GroupName;
            group.Persist();

            tab.Text = dlg.GroupName;

            if (group.ReferringGroupMap().Count > 0 && tabControl1.SelectedIndex == 0)
            {
                this.RefreshContextMenu();
                this.RefreshAllChannels();
            }
            else
            {
                this.RefreshContextMenu();
            }
        }
Example #5
0
        private void addToFavoritesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RadioChannelGroup group;
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;

            if (menuItem.Tag == null)
            {
                GroupNameForm dlg = new GroupNameForm();
                dlg.IsRadio = true;

                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                group = new RadioChannelGroup(dlg.GroupName, 9999);
                group.Persist();

                UpdateMenuAndTabs();
            }
            else
            {
                group = (RadioChannelGroup)menuItem.Tag;
            }

            ListView.SelectedIndexCollection indexes = listView1.SelectedIndices;
            if (indexes.Count == 0)
            {
                return;
            }

            TvBusinessLayer layer = new TvBusinessLayer();

            for (int i = 0; i < indexes.Count; ++i)
            {
                ListViewItem  item    = listView1.Items[indexes[i]];
                RadioGroupMap map     = (RadioGroupMap)item.Tag;
                Channel       channel = map.ReferencedChannel();
                layer.AddChannelToRadioGroup(channel, group.GroupName);
            }
        }
Example #6
0
        private void mpButtonRenameGroup_Click(object sender, EventArgs e)
        {
            GroupSelectionForm dlgGrpSel = new GroupSelectionForm();

            dlgGrpSel.Selection = GroupSelectionForm.SelectionType.ForRenaming;

            if (dlgGrpSel.ShowDialog(typeof(ChannelGroup), this) != DialogResult.OK)
            {
                return;
            }

            ChannelGroup group = dlgGrpSel.Group as ChannelGroup;

            if (group == null)
            {
                return;
            }

            GroupNameForm dlgGrpName = new GroupNameForm(group.GroupName);

            if (dlgGrpName.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            group.GroupName = dlgGrpName.GroupName;
            group.Persist();

            if (group.ReferringGroupMap().Count > 0)
            {
                this.RefreshAll();
            }
            else
            {
                this.RefreshContextMenu();
                this.RefreshTabs();
            }
        }
Example #7
0
        private void placeInHybridCardToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
            CardGroup         group;

            if (menuItem.Tag == null)
            {
                GroupNameForm dlg = new GroupNameForm();
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                group = new CardGroup(dlg.GroupName);
                group.Persist();
                UpdateMenu();
            }
            else
            {
                group = (CardGroup)menuItem.Tag;
            }
            ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
            if (indexes.Count == 0)
            {
                return;
            }
            for (int i = 0; i < indexes.Count; ++i)
            {
                ListViewItem item = mpListView1.Items[indexes[i]];
                Card         card = (Card)item.Tag;
                CardGroupMap map  = new CardGroupMap(card.IdCard, group.IdCardGroup);
                map.Persist();
                card.PreloadCard = false;
                card.Persist();
            }
            UpdateHybrids();
            RemoteControl.Instance.Restart();
        }
    private void addToFavoritesToolStripMenuItem_Click(object sender, EventArgs e)
    {
      RadioChannelGroup group;
      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;

      if (menuItem.Tag == null)
      {
        GroupNameForm dlg = new GroupNameForm();
        dlg.IsRadio = true;

        if (dlg.ShowDialog(this) != DialogResult.OK)
        {
          return;
        }

        group = new RadioChannelGroup(dlg.GroupName, 9999);
        group.Persist();

        UpdateMenuAndTabs();
      }
      else
      {
        group = (RadioChannelGroup)menuItem.Tag;
      }

      ListView.SelectedIndexCollection indexes = listView1.SelectedIndices;
      if (indexes.Count == 0)
        return;

      TvBusinessLayer layer = new TvBusinessLayer();

      for (int i = 0; i < indexes.Count; ++i)
      {
        ListViewItem item = listView1.Items[indexes[i]];
        RadioGroupMap map = (RadioGroupMap)item.Tag;
        Channel channel = map.ReferencedChannel();
        layer.AddChannelToRadioGroup(channel, group.GroupName);
      }
    }
Example #9
0
    private void mpButtonRenameGroup_Click(object sender, EventArgs e)
    {
      GroupSelectionForm dlgGrpSel = new GroupSelectionForm();
      dlgGrpSel.Selection = GroupSelectionForm.SelectionType.ForRenaming;

      if (dlgGrpSel.ShowDialog(typeof (ChannelGroup), this) != DialogResult.OK)
      {
        return;
      }

      ChannelGroup group = dlgGrpSel.Group as ChannelGroup;
      if (group == null)
      {
        return;
      }

      GroupNameForm dlgGrpName = new GroupNameForm(group.GroupName);
      if (dlgGrpName.ShowDialog(this) != DialogResult.OK)
      {
        return;
      }

      group.GroupName = dlgGrpName.GroupName;
      group.Persist();

      if (group.ReferringGroupMap().Count > 0)
      {
        this.RefreshAll();
      }
      else
      {
        this.RefreshContextMenu();
        this.RefreshTabs();
      }
    }
Example #10
0
    private void mpButtonAddGroup_Click(object sender, EventArgs e)
    {
      GroupNameForm dlg = new GroupNameForm();
      if (dlg.ShowDialog(this) != DialogResult.OK)
      {
        return;
      }

      ChannelGroup group = new ChannelGroup(dlg.GroupName, 9999);
      group.Persist();

      this.RefreshContextMenu();
      this.RefreshTabs();
    }
Example #11
0
    private void OnAddToFavoritesMenuItem_Click(object sender, EventArgs e)
    {
      ChannelGroup group;
      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
      if (menuItem.Tag == null)
      {
        GroupNameForm dlg = new GroupNameForm();
        if (dlg.ShowDialog(this) != DialogResult.OK)
        {
          return;
        }
        group = new ChannelGroup(dlg.GroupName, 9999);
        group.Persist();

        this.RefreshContextMenu();
        this.RefreshTabs();
      }
      else
      {
        group = (ChannelGroup)menuItem.Tag;
      }

      ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
      if (indexes.Count == 0)
        return;
      TvBusinessLayer layer = new TvBusinessLayer();
      for (int i = 0; i < indexes.Count; ++i)
      {
        ListViewItem item = mpListView1.Items[indexes[i]];

        Channel channel = (Channel)item.Tag;
        layer.AddChannelToGroup(channel, group.GroupName);

        string groupString = item.SubItems[1].Text;
        if (groupString == string.Empty)
        {
          groupString = group.GroupName;
        }
        else
        {
          groupString += ", " + group.GroupName;
        }

        item.SubItems[1].Text = groupString;
      }

      mpListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
    }
Example #12
0
    private void renameGroupToolStripMenuItem_Click(object sender, EventArgs e)
    {
      ToolStripDropDownItem menuItem = sender as ToolStripDropDownItem;
      if (menuItem == null)
      {
        return;
      }

      TabPage tab = menuItem.Tag as TabPage;
      if (tab == null)
      {
        return;
      }

      ChannelGroup group = tab.Tag as ChannelGroup;
      if (group == null)
      {
        return;
      }

      GroupNameForm dlg = new GroupNameForm(group.GroupName);

      dlg.ShowDialog(this);

      if (dlg.GroupName.Length == 0)
      {
        return;
      }

      group.GroupName = dlg.GroupName;
      group.Persist();

      tab.Text = dlg.GroupName;

      if (group.ReferringGroupMap().Count > 0 && tabControl1.SelectedIndex == 0)
      {
        this.RefreshContextMenu();
        this.RefreshAllChannels();
      }
      else
      {
        this.RefreshContextMenu();
      }
    }
Example #13
0
    private void OnAddToFavoritesMenuItem_Click(object sender, EventArgs e)
    {
      ChannelGroup group;
      ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
      if (menuItem.Tag == null)
      {
        GroupNameForm dlg = new GroupNameForm();
        if (dlg.ShowDialog(this) != DialogResult.OK)
        {
          return;
        }
        group = new ChannelGroup(dlg.GroupName, 9999);
        group.Persist();

        this.RefreshContextMenu();
        this.RefreshTabs();
      }
      else
      {
        group = (ChannelGroup)menuItem.Tag;
      }

      ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
      if (indexes.Count == 0)
        return;
      TvBusinessLayer layer = new TvBusinessLayer();
      for (int i = 0; i < indexes.Count; ++i)
      {
        ListViewItem item = mpListView1.Items[indexes[i]];

        Channel channel = (Channel)item.Tag;
        layer.AddChannelToGroup(channel, group.GroupName);

        IList<string> groups = channel.GroupNames;
        List<string> groupNames = new List<string>();
        foreach (string groupName in groups)
        {
          if (groupName != TvConstants.TvGroupNames.AllChannels &&
              groupName != TvConstants.RadioGroupNames.AllChannels)
          {
            //Don't add "All Channels"
            groupNames.Add(groupName);
          }
        }
        item.SubItems[2].Text = String.Join(", ", groupNames.ToArray());
      }

      mpListView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
    }
Example #14
0
 private void placeInHybridCardToolStripMenuItem_Click(object sender, EventArgs e)
 {
   ToolStripMenuItem menuItem = (ToolStripMenuItem)sender;
   CardGroup group;
   if (menuItem.Tag == null)
   {
     GroupNameForm dlg = new GroupNameForm();
     if (dlg.ShowDialog(this) != DialogResult.OK)
     {
       return;
     }
     group = new CardGroup(dlg.GroupName);
     group.Persist();
     UpdateMenu();
   }
   else
   {
     group = (CardGroup)menuItem.Tag;
   }
   ListView.SelectedIndexCollection indexes = mpListView1.SelectedIndices;
   if (indexes.Count == 0)
     return;
   for (int i = 0; i < indexes.Count; ++i)
   {
     ListViewItem item = mpListView1.Items[indexes[i]];
     Card card = (Card)item.Tag;
     CardGroupMap map = new CardGroupMap(card.IdCard, group.IdCardGroup);
     map.Persist();
     card.PreloadCard = false;
     card.Persist();
   }
   UpdateHybrids();
   RemoteControl.Instance.Restart();
 }