示例#1
0
 public void SetEP(ep_c_cfg ep)
 {
     tabPage2.CausesValidation = true;
     //Label label1 = new Label();
     //label1.Text = "电话号码:";
     //label1.Location = new System.Drawing.Point(4, 140);
     //label1.AutoSize = true;
     //this.tabPage1.Controls
 }
示例#2
0
 /// <summary>
 /// 双击,没有选中双击批量生成设备
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void context_DoubleClicked(object sender, EventArgs e)
 {
     try
     {
         if (this.panel1.m_pCurrentObject == null)
         {
             #region create object
             createAddDialog.StartPosition = FormStartPosition.CenterParent;
             if (createAddDialog.ShowDialog(this) == DialogResult.OK)
             {
                 MyObject.ObjectType obj = (MyObject.ObjectType)createAddDialog.cb_equtype.SelectedValue;
                 int count    = (int)createAddDialog.nd_equNum.Value;//需要生成对象的数量
                 int startNum = 1;
                 int.TryParse(createAddDialog.tb_startNum.Text, out startNum);
                 int cfgNum = 0;
                 try
                 {
                     cfgNum = int.Parse(createAddDialog.tb_cfgnum.Text);
                 }
                 catch (Exception)
                 {
                     Log.WriteLog("配置号码格式不正确");
                     createAddDialog.Hide();
                 }
                 DBOPs db         = new DBOPs();
                 int   parentWith = this.panel1.BackgroundImage.Size.Width;
                 for (int i = 0; i < count; i++)
                 {
                     var lacation = ((MouseEventArgs)e).Location;
                     int x        = (int)(parentWith - 2 * lacation.X) / (count - 1) * i + lacation.X;
                     lacation = new System.Drawing.Point {
                         X = x, Y = lacation.Y
                     };
                     MyObject myObject = panel1.DrawObject(obj.ToString(), lacation);
                     if (createAddDialog.checkbox_way.Checked)
                     {
                         myObject.equ.EquName = createAddDialog.tb_nameFirst.Text + (startNum++);
                     }
                     else
                     {
                         myObject.equ.EquName = createAddDialog.tb_nameFirst.Text + (startNum--);
                     }
                     if (obj == MyObject.ObjectType.EP_T)
                     {
                         ep_c_cfg ep = new ep_c_cfg();
                         ep.EquID = myObject.equ.EquID;
                         ep.Mesg  = myObject.equ.EquName;
                         if (createAddDialog.checkbox_way.Checked)
                         {
                             ep.EPNum = (cfgNum++).ToString();;
                         }
                         else
                         {
                             ep.EPNum = (cfgNum--).ToString();
                         }
                         db.InsertEp(ep);
                     }
                     else if (obj == MyObject.ObjectType.F_L || obj == MyObject.ObjectType.F_SB || obj == MyObject.ObjectType.F_YG)
                     {
                     }
                 }
             }
             #endregion
         }
         else
         {
             SetObjectPro();
         }
     }
     catch (Exception ex)
     {
         Log.WriteLog(ex);
     }
 }