Example #1
0
 private void bt_Remove_Click(object sender, EventArgs e)
 {
     if (listBox1.SelectedItem != null)
     {
         int obs = listBox1.Items.IndexOf(listBox1.SelectedItem);
         if (listBox1.SelectedItem.ToString().Contains("push"))
         {
             Intefaces.ObserverPush el = Subject.FindObserverPush(obs);
             Subject.Detach(el);
         }
         else
         {
             Intefaces.ObserverPull el = Subject.FindObserverPull(obs);
             Subject.Detach(el);
         }
         listBox1.Items.RemoveAt(obs);
         tabControl1.TabPages.RemoveAt(obs);
     }
 }