private void RemoveChannelButton_Click(object sender, EventArgs e) { if (selected_channel_ == null) { return; } DialogResult dr = MessageBox.Show("Are you sure you want to remove channel (" + selected_channel_.ToString() + ") from the lineup?", "Confirm deletion", MessageBoxButtons.YesNo); if (dr != DialogResult.Yes) { return; } try { ChannelEditing.DeleteChannel(selected_channel_); } catch (Exception exc) { ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc); key_valued_exception.AddKeyValue("Channel", selected_channel_); new ErrorReportingForm("Exception occured when deleting a channel.", key_valued_exception); } PopulateUserChannelsListBox(); }
private void ScannedLineupGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.RowIndex >= scanned_channels_.Count) { return; } Channel ch = scanned_channels_[e.RowIndex]; ScannedGridColumn column = ScannedColumnToEnum(e.ColumnIndex); switch (column) { case ScannedGridColumn.Listing: new ListingSelectionForm(ch).ShowDialog(); ScannedLineupGridView.InvalidateCell(e.ColumnIndex, e.RowIndex); break; case ScannedGridColumn.Remove: try { ChannelEditing.DeleteChannel(ch); } catch (Exception exc) { new ErrorReporter.ErrorReportingForm("Exception occured when attempting to remove channel.", exc); } SelectAndLoadScannedLineup(scanned_lineup_); break; } }
private void SyncButton_Click(object sender, EventArgs e) { foreach (Channel ch in selected_wmi_lineup.GetChannels()) { ChannelNumber channel_number = ch.ChannelNumber; Channel merged_channel = selected_merged_lineup.GetChannelFromNumber(channel_number.Number, channel_number.SubNumber); if (merged_channel == null) { // missing channel switch ((MissingChannelOptions)MissingChannelOptionsComboBox.SelectedIndex) { case MissingChannelOptions.AddMissingChannels: AppendDebugLine("Adding channel " + channel_number.ToString() + " callsign: " + ch.CallSign); Channel user_channel = ChannelEditing.AddUserChannelToLineupWithoutMerge( selected_scanned_lineup, ch.CallSign, channel_number.Number, channel_number.SubNumber, ModulationType.BDA_MOD_NOT_SET, ch.Service, selected_scanned_lineup.ScanDevices, ChannelType.CalculatedScanned); user_channel.Update(); MergedChannel new_merged_channel = ChannelEditing.CreateMergedChannelFromChannels( new List <Channel>(new Channel[] { user_channel }), channel_number.Number, channel_number.SubNumber, ChannelType.AutoMapped); new_merged_channel.Update(); break; case MissingChannelOptions.SkipMissingChannels: break; } } else { // existing channel switch ((ExistingChannelOptions)ExistingChannelOptionsComboBox.SelectedIndex) { case ExistingChannelOptions.ReplaceListing: if (merged_channel.Service.IsSameAs(ch.Service)) { AppendDebugLine("Channel " + channel_number.ToString() + " already good!"); break; } AppendDebugLine("Replacing listing on channel " + channel_number.ToString() + " old callsign: " + merged_channel.CallSign + " new callsign: " + ch.CallSign); merged_channel.Service = ch.Service; merged_channel.Update(); break; case ExistingChannelOptions.SkipExistingChannels: break; } } } foreach (Channel ch in selected_merged_lineup.GetChannels().ToArray()) { ChannelNumber channel_number = ch.ChannelNumber; Channel wmi_channel = selected_wmi_lineup.GetChannelFromNumber(channel_number.Number, channel_number.SubNumber); if (channel_number == null) { // extra channel switch ((ExtraChannelOptions)ExtraChannelOptionsComboBox.SelectedIndex) { case ExtraChannelOptions.KeepExtraChannels: break; case ExtraChannelOptions.RemoveExtraChannels: AppendDebugLine("Removing Extra channel " + channel_number.ToString() + " callsign: " + ch.CallSign); ChannelEditing.DeleteChannel(ch); break; } } } }