private void EditMenu_Click(object sender, EventArgs e)
 {
     ListViewItem li = RedundantConnectionsList.SelectedItems[0];
     GXAmiDeviceMedia m = li.Tag as GXAmiDeviceMedia;
     GXAmiDeviceProfile template = FindDeviceProfiles(Device.ProfileId, Templates.ToArray());
     RedundantForm dlg = new RedundantForm(UIDevice.GXClient, DataCollectors, template.AllowedMediaTypes, m);
     if (dlg.ShowDialog(this) == DialogResult.OK)
     {
         //Find name of DC.
         string dc = "";
         foreach (GXAmiDataCollector it in DataCollectors)
         {
             if (it.Id == m.DataCollectorId)
             {
                 dc = it.Name;
                 break;
             }
         }                
         li.SubItems[0].Text = m.Name;
         li.SubItems[1].Text = m.Settings;
         li.SubItems[2].Text = dc;
     }
 }       
 private void AddMenu_Click(object sender, EventArgs e)
 {
     GXAmiDeviceMedia m = new GXAmiDeviceMedia();
     GXAmiDeviceProfile template = FindDeviceProfiles(Device.ProfileId, Templates.ToArray());
     RedundantForm dlg = new RedundantForm(UIDevice.GXClient, DataCollectors, template.AllowedMediaTypes, m);
     if (dlg.ShowDialog(this) == DialogResult.OK)
     {
         MediaConnections.Add(m);
         AddConnection(m);
     }
 }