Exemplo n.º 1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (ModulationListBox.SelectedItem == null)
            {
                MessageBox.Show("New channel must have a modulation type.");
                this.DialogResult = DialogResult.None;
                return;
            }

            if (CallsignInput.TextValue == "")
            {
                MessageBox.Show("Channel must have a callsign.");
                this.DialogResult = DialogResult.None;
                return;
            }

            try
            {
                ChannelEditing.AddUserChannelAndMergedChannelInLineup(
                    lineup_, CallsignInput.TextValue,
                    (int)ChannelNumberInput.NumberValue, (int)SubChannelInput.NumberValue,
                    (ModulationListBox.SelectedItem as ModulationTypeWrapper).modulation_type,
                    (int)GuideChannelNumberInput.NumberValue, (int)GuideSubchannelInput.NumberValue,
                    ListingComboBox.SelectedItem as Service);
            }
            catch (Exception exc)
            {
                ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
                key_valued_exception.AddKeyValue("lineup", lineup_);
                key_valued_exception.AddKeyValue("Callsign", CallsignInput.TextValue);
                key_valued_exception.AddKeyValue("Subchannel", SubChannelInput.NumberValue);
                key_valued_exception.AddKeyValue("Modulation", ModulationListBox.SelectedItem);
                key_valued_exception.AddKeyValue("GuideNumber", GuideChannelNumberInput.NumberValue);
                key_valued_exception.AddKeyValue("GuideSubChannel", GuideSubchannelInput.NumberValue);
                key_valued_exception.AddKeyValue("Service", ListingComboBox.SelectedItem);
                new ErrorReportingForm("Exception occured when attempting to add a channel", key_valued_exception);
            }
            this.DialogResult = AddButton.DialogResult;
        }
Exemplo n.º 2
0
 private void ChannelUpdateButton_Click_1(object sender, EventArgs e)
 {
     Service selected_listing = (ListingComboBox.SelectedIndex > 0) ? ListingComboBox.SelectedItem as Service : null;
     try
     {
         selected_channel_.CallSign = CallsignEdit.TextValue;
         if (selected_channel_.Service != selected_listing)
         {
             DialogResult dr = MessageBox.Show("Update the listing of guide entries tied to this channel?",
                 "Listing selection for channel has been changed", MessageBoxButtons.YesNo);
             if (dr == DialogResult.Yes)
             {
                 foreach (MergedChannel merged_channel in selected_channel_.ReferencingPrimaryChannels)
                 {
                     merged_channel.Service = selected_listing;
                     merged_channel.Update();
                 }
                 foreach (MergedChannel merged_channel in selected_channel_.ReferencingSecondaryChannels)
                 {
                     merged_channel.Service = selected_listing;
                     merged_channel.Update();
                 }
             }
             selected_channel_.Service = ListingComboBox.SelectedItem as Service;
         }
     }
     catch (Exception exc)
     {
         ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
         key_valued_exception.AddKeyValue("Channel", selected_channel_);
         key_valued_exception.AddKeyValue("Callsign", CallsignEdit.TextValue);
         key_valued_exception.AddKeyValue("Service", selected_listing);
         key_valued_exception.AddKeyValue("Selected Channel Service", selected_channel_.Service);
         key_valued_exception.AddKeyValue("Service is different", selected_listing != selected_channel_.Service);
         new ErrorReportingForm("Exception occured when trying to update channel properties.", key_valued_exception);
     }
 }
Exemplo n.º 3
0
 private void RemoveTuningInfoClick(object sender, EventArgs e)
 {
     if (selected_tuning_info_ == null) return;
     DialogResult dr = MessageBox.Show("Delete selected tuning info from the selected channel?", "Are you sure?", MessageBoxButtons.YesNo);
     if (dr == DialogResult.Yes)
     {
         try
         {
             ChannelTuningInfo tuning_info = selected_tuning_info_;
             selected_channel_.TuningInfos.RemoveAllMatching(tuning_info);
             foreach (MergedChannel merged_channel in selected_channel_.ReferencingPrimaryChannels)
             {
                 merged_channel.TuningInfos.RemoveAllMatching(tuning_info);
             }
             foreach (MergedChannel merged_channel in selected_channel_.ReferencingSecondaryChannels)
             {
                 merged_channel.TuningInfos.RemoveAllMatching(tuning_info);
             }
         }
         catch (Exception exc)
         {
             ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
             key_valued_exception.AddKeyValue("tuning info", selected_tuning_info_);
             key_valued_exception.AddKeyValue("channel", selected_channel_);
             new ErrorReportingForm("Exception occured when deleting a tuning info", key_valued_exception);
         }
     }
 }
Exemplo n.º 4
0
 private void UpdateTuningInfoButton_Click(object sender, EventArgs e)
 {
     if (selected_tuning_info_ == null) return;
     try
     {
         selected_tuning_info_.PhysicalNumber = Decimal.ToInt32(PhysicalNumberInput.NumberValue);
         selected_tuning_info_.LogicalNumber = decimal.ToInt32(LogicalChannelInput.NumberValue);
         selected_tuning_info_.ModulationType = (ModulationTypeComboBox.SelectedItem as ModulationTypeWrapper).modulation_type;
     }
     catch (Exception exc)
     {
         ExceptionWithKeyValues key_valued_exception = new ExceptionWithKeyValues(exc);
         key_valued_exception.AddKeyValue("tuning info", selected_tuning_info_);
         key_valued_exception.AddKeyValue("Physical number", PhysicalNumberInput.NumberValue);
         key_valued_exception.AddKeyValue("Logical number", LogicalChannelInput.NumberValue);
         key_valued_exception.AddKeyValue("Modulation type", ModulationTypeComboBox.SelectedItem);
         new ErrorReportingForm("Exception occured while updating tuning info properties", key_valued_exception);
     }
 }
Exemplo n.º 5
0
 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();
 }