Пример #1
0
        private void btnRename_Click(object sender, EventArgs e)//重命名
        {
            try
            {
                if (SelectNode_Index == -1)
                {
                    MessageBox.Show("请点击选择需要设置的项目!");
                    tvwProj.Enabled         = true;
                    btnConfig.Enabled       = true;
                    btnAddProj.Enabled      = true;
                    btnDelProj.Enabled      = true;
                    btnCancelReName.Visible = false;;
                    return;
                }
                StaticClass.List_SMInfrared_Config = sqlCreate.Select_SMInfrared_Config();
                StructClass.StructSMInfrared_Config structSMInfrared_Config = StaticClass.List_SMInfrared_Config[SelectNode_Index];
                if (btnRename.Text == "重命名")
                {
                    tbxProjName.Text    = tvwProj.SelectedNode.Text;
                    tbxProjName.Visible = true;
                    btnRename.Text      = "确认";

                    btnCancelReName.Visible = true;
                    tvwProj.Enabled         = false;
                    btnConfig.Enabled       = false;
                    btnAddProj.Enabled      = false;
                    btnDelProj.Enabled      = false;
                }
                else if (btnRename.Text == "确认")
                {
                    if (!Match_ProjName_Leave())
                    {
                        return;
                    }
                    sqlCreate.UpDate_SMInfrared_Config(tbxProjName.Text, structSMInfrared_Config.DataBaseName, true);
                    tbxProjName.Text        = "";
                    tbxProjName.Visible     = false;
                    btnRename.Text          = "重命名";
                    btnCancelReName.Visible = false;
                    tvwProj.Enabled         = true;
                    btnConfig.Enabled       = true;
                    btnAddProj.Enabled      = true;
                    btnDelProj.Enabled      = true;
                }
                cbxProjName_Init();
                tvwProj_Init();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
 private void btnAddProj_Click(object sender, EventArgs e)//新增项目
 {
     if (tvwProj.Nodes.Count == 16)
     {
         MessageBox.Show("项目数量已达上限,最多支持16个项目!");
         return;
     }
     StaticClass.List_SMInfrared_Config = sqlCreate.Select_SMInfrared_Config();
     for (int i = 0; i <= 16; i++)
     {
         StructClass.StructSMInfrared_Config structSMInfrared_Config = StaticClass.List_SMInfrared_Config[i];
         if (structSMInfrared_Config.Enable == false)
         {
             sqlCreate.UpDate_SMInfrared_Config(structSMInfrared_Config.ProjName, structSMInfrared_Config.DataBaseName, true);
             break;
         }
     }
     cbxProjName_Init();
     tvwProj_Init();
 }