private void GetLinkedMessageAndColor(Channel channel, out string message, out Color rowColor) { bool isAutoLinked; bool duplicateChannelsFound; LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(channel, out isAutoLinked, out duplicateChannelsFound); if (duplicateChannelsFound) { message = "More than one channel found, change name or link manually"; rowColor = Color.Red; } else if (linkedChannel == null) { message = "Channel not linked, change name or link manually"; rowColor = Color.Red; } else if (isAutoLinked) { message = "Linked (auto)"; rowColor = Color.Black; } else { message = "Linked to " + linkedChannel.DisplayName; rowColor = Color.DarkGreen; } }
private static TvDatabase.Channel GetLinkedMediaPortalChannel(ChannelType channelType, Guid channelId, string displayName) { TvDatabase.Channel allocatedChannel = null; LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(channelType, channelId, displayName); if (linkedChannel != null) { allocatedChannel = TvDatabase.Channel.Retrieve(linkedChannel.Id); } return(allocatedChannel); }
private void CreateShareForm_Load(object sender, EventArgs e) { _channelNameLabel.Text = this.Channel.DisplayName; LoadGroups(); LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(this.Channel); if (linkedChannel != null) { SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.GroupMap)); sb.AddConstraint(Operator.Equals, "idChannel", linkedChannel.Id); SqlResult result = Broker.Execute(sb.GetStatement()); List <TvDatabase.GroupMap> groupMaps = (List <TvDatabase.GroupMap>) ObjectFactory.GetCollection(typeof(TvDatabase.GroupMap), result, new List <TvDatabase.GroupMap>()); if (groupMaps.Count > 0) { foreach (ListViewItem item in _groupsListView.Items) { if (item.Tag is int && (int)item.Tag == groupMaps[0].IdGroup) { item.Selected = true; _groupsListView.EnsureVisible(item.Index); break; } else { item.Selected = false; } } foreach (ListViewItem item in _channelsListView.Items) { ChannelItem channelItem = item.Tag as ChannelItem; if (channelItem.Channel.IdChannel == linkedChannel.Id) { item.Selected = true; _channelsListView.EnsureVisible(item.Index); break; } else { item.Selected = false; } } } } }