Esempio n. 1
0
 private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (selectedUCDev != null)
     {
         IDevices dev = (IDevices)selectedUCDev.Tag;
         dev.Close();
     }
 }
Esempio n. 2
0
 private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("是否确定要删除此项?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         ListViewItem item = this.listView1.SelectedItems[0];
         IDevices     dev  = (IDevices)item.Tag;
         if (dev.State == DevicesState.Opened)
         {
             dev.Close();
         }
         this.listView1.Items.Remove(item);
         Devices.DevicesCollection.Remove(dev);
     }
 }