Ejemplo n.º 1
0
        private void AddToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string strSele      = "";
            string strNewDevice = "";

            foreach (ListViewItem i in lv_Device.Items)
            {
                strSele = strSele + "," + i.Tag;
            }
            if (strSele != "")
            {
                strSele = strSele.Substring(1);
            }

            SelDevice newdevice = new SelDevice();

            newdevice.strSelDevice = strSele;
            newdevice.ShowDialog();
            strNewDevice = newdevice.newDevice;
            if (strNewDevice != "")
            {
                if (instrument_id != "")
                {
                    strNewDevice = instrument_id + "," + strNewDevice;
                }
                long OpStation = WritePrivateProfileString("EQUIPMENT", "INSTRUMENTID", strNewDevice, System.AppDomain.CurrentDomain.BaseDirectory.ToString() + inifile);
                initLvDevice();
                if (MessageBox.Show("仪器已改变是否要重新连接?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    BeginConn();
                }
            }
        }
Ejemplo n.º 2
0
        private void 增加仪器ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string strSele      = "";
            string strNewDevice = "";

            foreach (ListViewItem i in lv_Device.Items)
            {
                strSele = strSele + "," + i.Tag;
            }
            if (strSele != "")
            {
                strSele = strSele.Substring(1);
            }

            SelDevice newdevice = new SelDevice();

            newdevice.strSelDevice = strSele;
            newdevice.ShowDialog();
            strNewDevice = newdevice.newDevice;
            if (instrument_id != "")
            {
                strNewDevice = instrument_id + "," + strNewDevice;
            }
            long OpStation = WritePrivateProfileString("EQUIPMENT", "INSTRUMENTID", strNewDevice, System.AppDomain.CurrentDomain.BaseDirectory.ToString() + inifile);

            initLvDevice();
        }