Ejemplo n.º 1
0
        private void btnDeviceAdd_Click(object sender, EventArgs e)
        {
            var frm = new frmEditDevice();

            frm.Owner = this;
            frm.ShowDialog();
            DisplayDeviceList();
        }
Ejemplo n.º 2
0
        private void lvGWDevice_DoubleClick(object sender, EventArgs e)
        {
            string strDeviceID;

            if (lvGWDevice.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select the device first!", "Error");
                return;
            }

            strDeviceID = lvGWDevice.SelectedItems[0].Text.Trim();

            int i = 0;

            cls_Device_Info deviceTemp = this.gateway_Info.device_info.Where(o => o.device_name == strDeviceID).FirstOrDefault();

            if (deviceTemp == null)
            {
                return;
            }

            i = this.gateway_Info.device_info.FindIndex(p => p.device_name == deviceTemp.device_name);

            /*
             * foreach (cls_Device_Info di in this.gateway_Info.device_info)
             * {
             *  if (di.device_name == strDeviceID)
             *  {
             *      deviceTemp = this.gateway_Info.device_info[i];
             *      break;
             *  }
             *  i++;
             * }
             */

            if (this.isCopy)
            {
                deviceTemp.device_name = "";
            }

            var frm = new frmEditDevice(deviceTemp, i);

            frm.Owner = this;
            frm.ShowDialog();

            DisplayDeviceList();
            lvGWDevice.Focus();
        }