Пример #1
0
 private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left && e.Clicks == 2)
     {
         Equipment     eq      = gridView1.GetFocusedRow() as Equipment;
         AddDeviceForm addform = new AddDeviceForm(eq);
         if (addform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             InitList();
         }
     }
 }
Пример #2
0
        // 添加
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            AddDeviceForm addfff = new AddDeviceForm();

            if (addfff.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Register(addfff.SensorName);
                InitList();
                if (AddEvent != null)
                {
                    AddEvent();
                }
            }
        }
Пример #3
0
        // 全选
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            //foreach (Equipment item in list)
            //{
            //    if (!item.IsRegister)
            //    {
            //        item.IsSelect = true;
            //    }
            //}
            Equipment     eq      = gridView1.GetFocusedRow() as Equipment;
            AddDeviceForm addform = new AddDeviceForm(eq);

            if (addform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                InitList();
            }
        }
Пример #4
0
        // 更新
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            Equipment     eq      = gridView1.GetFocusedRow() as Equipment;
            AddDeviceForm addform = new AddDeviceForm(eq);

            if (addform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!EquipmentDal.UpdateOne(addform.mEquipment))
                {
                    XtraMessageBox.Show("更新设备失败");
                }
                else
                {
                    InitList();
                }
            }
        }
Пример #5
0
        // 添加
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            byte          addr   = list == null ? (byte)0 : list.LastOrDefault().Address;
            AddDeviceForm addfff = new AddDeviceForm(addr);

            if (addfff.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!EquipmentDal.AddOne(addfff.mEquipment))
                {
                    LogLib.Log.GetLogger(this).Warn("插入失败");
                    XtraMessageBox.Show("添加设备失败");
                }
                else
                {
                    InitList();
                }
            }
        }