private void btnDelete_Click(object sender, EventArgs e) { try { if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0) { FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000); return; } ConstantType entity = CGridHelper.GetCurrentData <ConstantType>(dgv); ConstantApi constantApi = new ConstantApi(); var resp = constantApi.DeleteConstantType(entity.ID); //string sql = "DELETE ConstantType WHERE ID = @ID"; //Hashtable hashtable = new Hashtable(); //hashtable.Add("ID", entity.ID); //if (_mssqlHelper.ExcuteNonQuery(sql, hashtable) > 0) //{ if (resp.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "删除成功!", ContentAlignment.MiddleCenter, 1000); CGridHelper.DeleteRow(dgv); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "删除失败!" + resp.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "删除异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000); } }
private void btnSave_Click(object sender, EventArgs e) { ChargeRecord chargeRecord = new ChargeRecord(); chargeFiller.FillEntity(chargeRecord); chargeRecord.DateOfCharge = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); chargeRecord.ChagreUser = AppHelper.UserName; List <ChargeDetail> details = GetChargeDetails(chargeRecord.PlateNo, chargeRecord.TestNo, out string testItem); chargeRecord.TestItem = testItem; ChargeApi chargeApi = new ChargeApi(); chargeApi.SaveChargeDetails(details); var resp = chargeApi.SaveChargeRecord(chargeRecord); if (resp.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "保存成功", ContentAlignment.MiddleCenter); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败" + resp?.Message, ContentAlignment.MiddleCenter); } }
private void ucBtnExt3_BtnClick(object sender, EventArgs e) { string direc = ""; string from = ""; string to = ""; if (direction.BtnText == "仪器>>LIS") { direc = "MTL"; from = "仪器"; to = "LIS"; } if (direction.BtnText == "仪器<<LIS") { direc = "LTM"; from = "LIS"; to = "仪器"; } if (direction.BtnText == "仪器==LIS") { direc = "=="; from = "仪器/LIS"; to = "LIS/仪器"; } if (oldstring.TextLength > 0 && newstring.TextLength > 0 && direc.Length > 0 && Info.TextLength > 0) { if (FrmDialog.ShowDialog(this, "将新增一条条目:\r\n\r\n转换条目说明:[" + Info.Text + "]\r\n从[" + from + "]发送至[" + to + "]的数据[" + oldstring.Text + "]转换成[" + newstring.Text + "]\r\n\r\n确定吗?", "新增条目", true) == DialogResult.OK) { AcceseDatabase.InsertItem(oldstring.Text, direc, newstring.Text, Info.Text); refreshlist(); } } else { FrmTips.ShowTipsError(this, "请检查输入内容"); } }
private void ucBtnExt2_BtnClick(object sender, EventArgs e) { if (StringView.SelectedItems.Count == 0) { FrmTips.ShowTipsError(this, "请选择至少一项"); } else { string buf = ""; foreach (ListViewItem cell in StringView.SelectedItems) { buf += "序号:" + cell.Text + " 说明:" + cell.SubItems[4].Text + "\r\n"; } if (FrmDialog.ShowDialog(this, "当前选择了" + StringView.SelectedItems.Count + "条转换条目:\r\n\r\n" + buf + "\r\n是否确定切换激活状态", "切换激活状态", true) == DialogResult.OK) { string status = ""; foreach (ListViewItem item in StringView.SelectedItems) { if (item.SubItems[5].Text == "激活") { status = "cancel"; } if (item.SubItems[5].Text == "未激活") { status = "active"; } AcceseDatabase.ToggleActive(item.Text, status); } refreshlist(); } } }
//删除 private void BtnDel_BtnClick(object sender, EventArgs e) { var result = FrmDialog.ShowDialog(this, "确定删除选择的记录?", "删除记录", true); if (result == DialogResult.OK) { var rows = DataGrid.SelectRows; if (rows != null) { var ids = string.Empty; rows.ForEach(p => ids += $"{((AssetsInformation)((UCDataGridViewRow)p).DataSource).id},"); ids = ids.TrimEnd(','); using (var db = new AssetsInformationDB(dbPath)) { db.Query <AssetsInformation>($"delete from assetsinformation where id in ({ids})"); } GetList(); //rows.ForEach(p => //{ // if (!string.IsNullOrWhiteSpace(((AssetsInformation)((UCDataGridViewRow)p).DataSource).QdPath)) // { // if (File.Exists(((AssetsInformation)((UCDataGridViewRow)p).DataSource).QdPath)) // { // FileHelper.FileDel(((AssetsInformation)((UCDataGridViewRow)p).DataSource).QdPath); // } // } //}); FrmTips.ShowTips(this, $"删除成功!", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(200, 80), TipsState.Success); } } }
private void btnSave_BtnClick(object sender, EventArgs e) { try { if (!validator1.Validate()) { return; } entityFiller.FillEntity(m_chargeDefine); m_chargeDefine.ItemName = combDefine.Text; m_chargeDefine.ItemCode = combDefine.SelectedValue.ToString(); ConstantApi constantApi = new ConstantApi(); var responseModel = constantApi.SaveChargeDefine(m_chargeDefine); //bool succ = _mssqlHelper.InsertOrUpdate(m_netTypeDefine, null, new string[] { "ID" }, null); if (responseModel.Code.Equals(1)) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "保存成功!", ContentAlignment.MiddleCenter, 1000); bIsUpdate = true; this.DialogResult = DialogResult.OK; this.Close(); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败!" + responseModel.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败!" + ex.Message, ContentAlignment.MiddleCenter, 1000); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0) { FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000); return; } Menus entity = CGridHelper.GetCurrentData <Menus>(dgv); MenuApi constantApi = new MenuApi(); var resp = constantApi.DeleteMenu(entity.Id); if (resp.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "删除成功!", ContentAlignment.MiddleCenter, 1000); CGridHelper.DeleteRow(dgv); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "删除失败!" + resp.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "删除异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000); } }
private void ucBtnExt1_BtnClick(object sender, EventArgs e) { try { Properties.Settings.Default.MachineName = MachineName.Text; Properties.Settings.Default.ProgramName = ProgramName.Text; Properties.Settings.Default.ShortcutName = ShortcutName.Text; Properties.Settings.Default.CleaningTimer = (CleaningTimer.Value * 60000).ToString(); Properties.Settings.Default.ApplyTimer = (ApplyTimer.Value * 1000).ToString(); Properties.Settings.Default.SendBuff = SendBuff.SelectedItem.ToString(); Properties.Settings.Default.LogsReserve = LogsReserve.Value.ToString(); Properties.Settings.Default.LISport = LISport.Text; Properties.Settings.Default.TerminalPort = textBox2.Text; Properties.Settings.Default.MainPage = comboBox6.SelectedIndex.ToString(); Properties.Settings.Default.TerminalPassword = textBox1.Text; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); //MessageBox.Show("保存成功"); } catch (Exception ex) { FrmTips.ShowTipsError(this, "设置保存失败:" + ex.Message); //MessageBox.Show("保存失败:" + ex.Message); } }
private void 设为开机启动ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (设为开机启动ToolStripMenuItem.Checked == false) //设置开机自启动 { string path = Application.ExecutablePath; RegistryKey rk = Registry.LocalMachine; RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); rk2.SetValue("JcShutdown", path); rk2.Close(); rk.Close(); 设为开机启动ToolStripMenuItem.Checked = true; Properties.Settings.Default.Startup = true; } else //取消开机自启动 { string path = Application.ExecutablePath; RegistryKey rk = Registry.LocalMachine; RegistryKey rk2 = rk.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); rk2.DeleteValue("JcShutdown", false); rk2.Close(); rk.Close(); 设为开机启动ToolStripMenuItem.Checked = false; Properties.Settings.Default.Startup = false; } } catch (Exception ex) { FrmTips.ShowTipsWarning(this, "请使用管理员模式运行"); //MessageBox.Show(ex.Message,"请使用管理员模式"); } NotifyMenu.Show(); }
private void NotifyMenu_Opening(object sender, System.ComponentModel.CancelEventArgs e) { try { string path = Application.ExecutablePath; RegistryKey rk = Registry.LocalMachine; RegistryKey rk2 = rk.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run"); string[] rest = rk2.GetValueNames(); foreach (string line in rest) { if (line == "JcShutdown") { 设为开机启动ToolStripMenuItem.Checked = true; } else { 设为开机启动ToolStripMenuItem.Checked = false; } } } catch (Exception ex) { FrmTips.ShowTipsWarning(this, "请使用管理员模式运行"); //MessageBox.Show(ex.Message, "请使用管理员模式运行本程序"); } }
//生成二维码 private void BtnCreateQr_BtnClick(object sender, EventArgs e) { var rows = DataGrid.SelectRows; if (rows != null) { var ids = string.Empty; rows.ForEach(p => ids += $"{((AssetsInformation)((UCDataGridViewRow)p).DataSource).id},"); ids = ids.TrimEnd(','); using (var db = new AssetsInformationDB(dbPath)) { var list = db.Query <AssetsInformation>($"select * from assetsinformation where id in ({ids})"); if (list != null && list.Any()) { foreach (var item in list) { item.QdPath = QRCodeHelper.CreateQRCodeImage(new QRCodeMsg() { Content = $"资产编码:{item.AssetCode}\r\n资产名称:{item.AssetName}\r\n资产类型:{item.AssetModel}\r\n管理部门:{item.ManagementDepartment}\r\n使用部门:{item.UseDepartment}\r\n使用状态:{item.UseState}\r\n使用年限:{item.UseDate}\r\n使用地点:{item.UsePlace}\r\n安装日期:{item.InstallationDate}", ImageName = $"{item.AssetCode}{DateTime.Now.ToLongDateString()}{DateTime.Now.Hour}{DateTime.Now.Minute}{DateTime.Now.Second}", FilePath = $"{Environment.CurrentDirectory}" }); } db.UpdateAll(list); } } FrmTips.ShowTips(this, $"二维码生成成功!", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(200, 80), TipsState.Success); GetList(); } }
private void button4_Click(object sender, EventArgs e) { FrmTips.ShowTipsError(this, "Error提示信息"); FrmTips.ShowTipsInfo(this, "Info提示信息"); FrmTips.ShowTipsSuccess(this, "Success提示信息"); FrmTips.ShowTipsWarning(this, "Warning提示信息"); }
private void keepfile_CheckedChanged(object sender, EventArgs e) { if (keepfile.Checked != Properties.Settings.Default.FileKeepFile) { Properties.Settings.Default.FileKeepFile = keepfile.Checked; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } }
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e) { if (Properties.Settings.Default.SerialStopBit != comboBox4.SelectedItem.ToString()) { Properties.Settings.Default.SerialStopBit = comboBox4.SelectedItem.ToString(); Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } }
private void clienttimer_ValueChanged(object sender, EventArgs e) { if (Properties.Settings.Default.ClientTimer != (clienttimer.Value * 1000).ToString()) { Properties.Settings.Default.ClientTimer = (clienttimer.Value * 1000).ToString(); Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } }
private void filewriteextension_TextChanged(object sender, EventArgs e) { if (Properties.Settings.Default.FileWriteExtension != filewriteextension.Text) { Properties.Settings.Default.FileWriteExtension = filewriteextension.Text; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } }
private void btnSearch_Click(object sender, EventArgs e) { List <Role> list = null; ControlHelper.ThreadRunExt(AppHelper.MainForm, () => { var succ = true; var msg = ""; try { ResponseModel responseModel = new ResponseModel(); RbacApi rbac = new RbacApi(); responseModel = rbac.GetRoles(); if (responseModel.Code == 1) { if (responseModel.DataCount > 0) { list = JsonConvert.DeserializeObject <List <Role> >(responseModel?.Data?.ToString()); ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { if (list != null) { CGridHelper.ClearGrid(dgv); CGridHelper.FillGrid <Role>(dgv, list); } }); } else { succ = false; msg = "查询数据为空!"; } } else { succ = false; msg = responseModel?.Message; } } catch (Exception ex) { succ = false; msg = ex.Message; } if (!succ) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在查询……", 200); }
private void ucBtnExt8_BtnClick(object sender, EventArgs e) { comboBox1.Items.Add(comboBox1.Text); if (Properties.Settings.Default.SerialBaudRate != comboBox1.Text) { Properties.Settings.Default.SerialBaudRate = comboBox1.Text; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } }
private void ucBtnExt7_BtnClick(object sender, EventArgs e) { if (folderBrowserDialog2.ShowDialog() == DialogResult.OK) { filewritepath.Text = folderBrowserDialog2.SelectedPath; Properties.Settings.Default.FileWritePath = filewritepath.Text; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } }
private void btnSave_Click(object sender, EventArgs e) { settingFiller.FillEntity(AppHelper.DbSetting); File.WriteAllText(AppHelper.DbConfigFile, JsonConvert.SerializeObject(AppHelper.DbSetting, Formatting.Indented)); FrmTips.ShowTips(AppHelper.MainForm, "保存成功", 1000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success); MssqlHelper.GetInstance().Init(AppHelper.DbSetting.DataBaseServer, AppHelper.DbSetting.DataBaseName, AppHelper.DbSetting.DataBaseUser, AppHelper.DbSetting.DataBasePwd); }
private void btnSave_BtnClick(object sender, EventArgs e) { try { if (!validator1.Validate()) { return; } entityFiller.FillEntity(m_user); RbacApi rbac = new RbacApi(); ResponseModel response = new ResponseModel(); if (IsModify) { response = rbac.ModifyUser(m_user); } else { response = rbac.AddUser(m_user); } if (response.Code == 1) { User user = JsonConvert.DeserializeObject <User>(response.Data.ToString()); //保存角色信息 List <int> roleIds = new List <int>(); List <UserRoleMap> userRoleMaps = new List <UserRoleMap>(); GetCheckedMenuIds(tvMenus.Nodes, roleIds); foreach (var item in roleIds) { userRoleMaps.Add(new UserRoleMap() { UserId = user.Id, RoleId = item }); } rbac.SaveUserRole(userRoleMaps.ToArray()); FrmTips.ShowTipsSuccess(AppHelper.MainForm, "保存成功!", ContentAlignment.MiddleCenter, 1000); bIsUpdate = true; this.DialogResult = DialogResult.OK; this.Close(); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败!" + response.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败!" + ex.Message, ContentAlignment.MiddleCenter, 1000); } }
//导入 private void BtnImport_BtnClick(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "Excel表格|*.xlsx"; fileDialog.CheckFileExists = true; if (fileDialog.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(fileDialog.FileName)) { //获取excel文件 var file = new System.IO.FileInfo(fileDialog.FileName); System.Data.DataTable dt = null; using (var package = new ExcelPackage(file)) { //获取workbook ExcelWorkbook workbook = package.Workbook; if (workbook != null) { if (workbook.Worksheets.Count > 0) { //获取workbook的第一个worksheet ExcelWorksheet worksheet = workbook.Worksheets[1]; //将worksheet转成datatable dt = Common.ExcelHelper.WorksheetToTable(worksheet); if (dt != null && dt.Rows.Count > 0) { List <AssetsInformation> list = new List <AssetsInformation>(); foreach (DataRow row in dt.Rows) { AssetsInformation entity = new AssetsInformation(); entity.AssetName = row["资产名称"]?.ToString(); entity.AssetCode = row["资产编码"]?.ToString(); entity.AssetModel = row["资产型号"]?.ToString(); entity.ManagementDepartment = row["管理部门"]?.ToString(); entity.UseDepartment = row["使用部门"]?.ToString(); entity.UseState = row["使用状态"]?.ToString(); entity.UseDate = row["使用年限"]?.ToString(); entity.UsePlace = row["使用地点"]?.ToString(); entity.InstallationDate = Convert.ToDateTime(row["安装日期"]?.ToString()).ToLongDateString(); entity.QdPath = $"{Environment.CurrentDirectory}\\NoBackPic.png"; list.Add(entity); } using (var db = new AssetsInformationDB(dbPath)) { int count = db.InsertAll(list); var source = db.Query <AssetsInformation>("select * from assetsinformation"); FrmTips.ShowTips(this, $"导入{count}条记录", 3000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Large, new Size(300, 100), TipsState.Success); } GetList(); } } } } } }
private void button5_Click(object sender, EventArgs e) { ControlHelper.ThreadRunExt(this, () => { Thread.Sleep(5000); ControlHelper.ThreadInvokerControl(this, () => { FrmTips.ShowTipsSuccess(this, "FrmWaiting测试"); }); }, null, this); }
public static void Error(string msg) { _logHelper.Error(msg); if (AppHelper.MainForm != null) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { //Size size = new Size(300,900); FrmTips.ShowTips(AppHelper.MainForm, msg, 5 * 1000, true, System.Drawing.ContentAlignment.BottomRight, null, TipsSizeMode.Large, null, TipsState.Error); }); } }
private void clientport_TextChanged(object sender, EventArgs e) { if (clientport.Text.Length > 0) { if (clientport.Text != Properties.Settings.Default.ClientPort) { Properties.Settings.Default.ClientPort = clientport.Text; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } } }
/// <summary> /// 登录按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text)) { return; } string msg; string id = textBox1.Text.Trim(); string pwd = textBox2.Text.Trim(); if (ucSwitch1.Checked) { TeacherBLL bll = new TeacherBLL(); Boolean b = bll.GetTeacherInfo(id, pwd, out msg); if (b) { //FrmTips.ShowTipsSuccess(this, msg); //fea.Obj = bll.GetTeacher(id); //FrmTeacherMain frmTeacher = new FrmTeacherMain(); //this.evtFt += new EventHandler(frmTeacher.SetTxt); //if (this.evtFt!=null) //{ // this.evtFt(this, fea); // frmTeacher.ShowDialog(); //} FrmTips.ShowTipsSuccess(this, msg); this.Tag = bll.GetTeacher(id); this.DialogResult = DialogResult.OK; } else { FrmTips.ShowTipsError(this, msg); } } else { StudentBLL bll = new StudentBLL(); Student stu = new Student(); bool b = bll.getStudentInfoBySid(id, pwd, out msg, out stu); if (b) { this.Tag = stu; this.DialogResult = DialogResult.Yes; } else { FrmTips.ShowTipsError(this, msg); } } }
private void tbarVolume_ValueChanged(object sender, EventArgs e) { try { UCTrackBar bar = (UCTrackBar)sender; var value = Convert.ToInt32(bar.Value); _player.Volume = value; } catch (Exception) { FrmTips.ShowTipsWarning(this, "出现未知错误"); } }
private void UcSwitch1_CheckedChanged(object sender, EventArgs e) { uint k = Convert.ToUInt32(ucSwitch1.Checked); int i = NGIDevice.WriteUint(2, k); if (k == 1) { if (i != 1) { FrmTips.ShowTips(this.ParentForm, "输出失败", 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Error); ucSwitch1.Checked = false; } } }
public void refreshlist() { StringView.Items.Clear(); DataSet ds = AcceseDatabase.GetAll(); string direc = ""; string status = ""; for (int i = 0; i < ds.Tables["TransData"].Rows.Count; i++)//遍历BookInfo中所有行 { if (ds.Tables["TransData"].Rows[i]["IOROW"].ToString() == "LTM") { direc = "LIS>>仪器"; } if (ds.Tables["TransData"].Rows[i]["IOROW"].ToString() == "MTL") { direc = "仪器>>LIS"; } if (ds.Tables["TransData"].Rows[i]["IOROW"].ToString() == "==") { direc = "LIS==仪器"; } if (ds.Tables["TransData"].Rows[i]["ActiveStatus"].ToString() == "active") { status = "激活"; } if (ds.Tables["TransData"].Rows[i]["ActiveStatus"].ToString() == "cancel") { status = "未激活"; } ListViewItem lvi = new ListViewItem(); lvi.SubItems[0].Text = ds.Tables["TransData"].Rows[i]["ID"].ToString(); lvi.SubItems.AddRange(new string[] { ds.Tables["TransData"].Rows[i]["MacString"].ToString(), direc, ds.Tables["TransData"].Rows[i]["LISString"].ToString(), ds.Tables["TransData"].Rows[i]["Note"].ToString(), status, }); StringView.Items.Add(lvi);//将数据添加到listview中 } foreach (ListViewItem item in StringView.Items) { if (item.SubItems[5].Text == "未激活") { item.BackColor = Color.FromArgb(255, 77, 59); } } FrmTips.ShowTipsSuccess(this, "列表加载完成"); }
private void UcSwitch2_CheckedChanged(object sender, EventArgs e) { if (ucSwitch2.Checked) { if (!OpenLink()) { FrmTips.ShowTips(this.ParentForm, "连接失败", 3000, false, ContentAlignment.BottomCenter, null, TipsSizeMode.Large, null, TipsState.Error); ucSwitch2.Checked = false; } } else { NGIDevice.close(); } }