private void onTrashChannelsSelectedIndexChanged(object sender, EventArgs e) { int index = this.mTrashChannelsListBox.SelectedIndex; RecurringChannel channel = this.mRecurringTrash[index]; this.mTrashShowsListBox.Items.Clear(); foreach (RecurringRecording rec in channel.Shows) { this.mTrashShowsListBox.Items.Add(string.Concat(rec.Name, " | ", rec.CreateRuleString())); } }
private void onTrashDownClick(object sender, EventArgs e) { int index = this.mChannelsListBox.SelectedIndex; RecurringRecordingList recList = this.mRecurringChannels[index]; index = this.mShowsListBox.SelectedIndex; RecurringRecording rec = recList[index]; RecurringChannel channel; if (this.mRecurringTrashCount == 0) { channel = new RecurringChannel(rec.ChannelOID, rec.ChannelName, recList); channel.Shows.Add(rec); this.mRecurringTrash[this.mRecurringTrashCount++] = channel; this.mTrashChannelsListBox.Items.Add(string.Concat(channel.Name, " | 1")); } else { int i = 0; channel = this.mRecurringTrash[i]; while (i < this.mRecurringTrashCount && channel.OID != rec.ChannelOID) { channel = this.mRecurringTrash[++i]; } if (i == this.mRecurringTrashCount) { channel = new RecurringChannel(rec.ChannelOID, rec.ChannelName, recList); channel.Shows.Add(rec); this.mRecurringTrash[this.mRecurringTrashCount++] = channel; this.mTrashChannelsListBox.Items.Add(string.Concat(channel.Name, " | 1")); } else { channel.Shows.Add(rec); this.mTrashChannelsListBox.Items[i] = string.Concat(channel.Name, " | ", channel.Shows.Count.ToString()); } } if (recList.Count > 1) { this.mShowsListBox.SelectedIndex = index == 0 ? 1 : index - 1; } recList.RemoveAt(index); this.mShowsListBox.Items.RemoveAt(index); if (recList.Count == 0) { index = this.mChannelsListBox.SelectedIndex; if (this.mRecurringChannelCount > 1) { this.mChannelsListBox.SelectedIndex = index == 0 ? 1 : index - 1; } this.mRecurringChannelCount--; for (int j = index; j < this.mRecurringChannelCount; j++) { this.mRecurringChannels[j] = this.mRecurringChannels[j + 1]; } this.mChannelsListBox.Items.RemoveAt(index); } this.mChannelUpButton.Enabled = this.mRecurringChannelCount > 1; this.mChannelDownButton.Enabled = this.mRecurringChannelCount > 1; this.mTrashUpButton.Enabled = true; this.mTrashDownButton.Enabled = this.mRecurringChannelCount == 0; }
private void onTrashUpClick(object sender, EventArgs e) { int index = this.mTrashChannelsListBox.SelectedIndex; RecurringChannel channel = this.mRecurringTrash[index]; index = this.mTrashShowsListBox.SelectedIndex; RecurringRecording show = channel.Shows[index]; RecurringRecordingList recList; if (this.mRecurringChannelCount == 0) { recList = channel.List; recList.Add(show); this.mRecurringChannels[this.mRecurringChannelCount++] = recList; this.mChannelsListBox.Items.Add(string.Concat(channel.Name, " | 1")); } else { int i = 0; recList = this.mRecurringChannels[i]; while (i < this.mRecurringChannelCount && recList.ChannelOID != channel.OID) { recList = this.mRecurringChannels[++i]; } if (i == this.mRecurringChannelCount) { recList = channel.List; recList.Add(show); this.mRecurringChannels[this.mRecurringChannelCount++] = recList; this.mChannelsListBox.Items.Add(string.Concat(channel.Name, " | 1")); } else { recList.Add(show); this.mChannelsListBox.Items[i] = string.Concat(channel.Name, " | ", recList.Count.ToString()); } } if (channel.Shows.Count > 1) { this.mTrashShowsListBox.SelectedIndex = index == 0 ? 1 : index - 1; } channel.Shows.RemoveAt(index); this.mTrashShowsListBox.Items.RemoveAt(index); if (channel.Shows.Count == 0) { index = this.mTrashChannelsListBox.SelectedIndex; if (this.mRecurringTrashCount > 0) { this.mTrashChannelsListBox.SelectedIndex = index == 0 ? 1 : index - 1; } this.mRecurringTrashCount--; for (int j = index; j < this.mRecurringTrashCount; j++) { this.mRecurringTrash[j] = this.mRecurringTrash[j + 1]; } this.mTrashChannelsListBox.Items.RemoveAt(index); } this.mChannelUpButton.Enabled = this.mRecurringChannelCount > 1; this.mChannelDownButton.Enabled = this.mRecurringChannelCount > 1; this.mTrashUpButton.Enabled = this.mRecurringTrashCount == 0; this.mTrashDownButton.Enabled = true; }