Exemple #1
0
 private void ButtonEditChannel_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (ListBoxChannelList.SelectedItems.Count == 1)
         {
             Channel c = channels.Find(x =>
                                       x.Name.Equals(ListBoxChannelList.SelectedItem.ToString().Split('(')[0].Trim()));
             channels.Remove(c);
             //relies on the toString() method of channel.cs starting with the name and having a '(' afterwards
             AddEditChannelWindow ecw = new AddEditChannelWindow(this, c);
             ecw.Show();
         }
         else if (ListBoxChannelList.SelectedItems.Count == 0)
         {
             LabelMessage.Content = "Select channel to edit.";
         }
         else
         {
             LabelMessage.Content = "You can only edit one channel at a time.";
         }
     }
     catch (Exception)
     {
         LabelMessage.Content = "Error trying to edit channel";
     }
 }
Exemple #2
0
 private void ButtonAddChannel_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         AddEditChannelWindow acw = new AddEditChannelWindow(this, null);
         acw.Show();
     }
     catch (Exception)
     {
         LabelMessage.Content = "Error trying to add channel.";
     }
 }