private void btnSave_BtnClick(object sender, EventArgs e) { try { if (!validator1.Validate()) { return; } entityFiller.FillEntity(m_menus); m_menus.ParentId = Convert.ToInt32(combMenus.SelectedValue); if (m_menus.ParentId != 0) { m_menus.ParentName = combMenus.Text; } MenuApi menuApi = new MenuApi(); ResponseModel responseModel = new ResponseModel(); if (!IsModify) { responseModel = menuApi.AddMenu(m_menus); } else { responseModel = menuApi.ModifyMenu(m_menus); } if (responseModel.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "保存成功!", ContentAlignment.MiddleCenter, 1000); m_menus = JsonConvert.DeserializeObject <Menus>(responseModel.Data.ToString()); 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 checkBox2_CheckedChangeEvent(object sender, EventArgs e) { if (checkBox2.Checked == true) { if (Properties.Settings.Default.ConnectWay != "0") { Properties.Settings.Default.ConnectWay = "0"; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); checkBox1.Checked = false; checkBox3.Checked = false; checkBox4.Checked = false; checkBox1.Enabled = true; checkBox2.Enabled = false; checkBox3.Enabled = true; checkBox4.Enabled = true; } } }
private void ucBtnExt4_BtnClick(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == DialogResult.OK) { try { string path = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath; if (System.IO.File.Exists(saveFileDialog1.FileName)) { System.IO.File.Delete(saveFileDialog1.FileName); } System.IO.File.Copy(path, saveFileDialog1.FileName); FrmTips.ShowTipsSuccess(this, "设置已导出:" + saveFileDialog1.FileName); } catch (Exception ex) { FrmTips.ShowTipsError(this, "设置导出错误:" + saveFileDialog1.FileName); } } }
//保存按钮 private void ucBtnSave_BtnClick(object sender, EventArgs e) { bool b; if (!Check.isStudentID(txtEdSID.Text)) { b = false; FrmTips.ShowTipsWarning(this, "学号格式不正确"); return; } try { Student stu = new Student(); stu.SName = txtEdSname.Text; stu.SID = txtEdSID.Text; stu.SGender = cmbEdGender.Text; stu.Class = cmbEdClass.SelectedValue.ToString(); stu.Departments = cmbEdCollege.SelectedValue.ToString(); stu.Birthday = Convert.ToDateTime(dtpEdBir.Value.ToString("yyy/MM/dd")); stu.AdmissionTime = Convert.ToDateTime(dtpEdAdm.Value.ToString("yyy/MM/dd")); stu.Image = null; StudentBLL bll = new StudentBLL(); b = bll.UpdateStudentInfo(stu); } catch (Exception) { b = false; } if (b) { FrmTips.ShowTipsSuccess(this, "修改成功"); } else { FrmTips.ShowTipsError(this, "修改失败"); } }
private void clientip_TextChanged(object sender, EventArgs e) { try { IPAddress ip = IPAddress.Parse(clientip.Text); if (Properties.Settings.Default.ClientIP != clientip.Text) { try { Properties.Settings.Default.ClientIP = clientip.Text; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); } catch (Exception ex) { FrmTips.ShowTipsError(this, "设置保存失败:" + ex.Message); } } } catch (Exception) { } }
private void ucBtnExt5_BtnClick(object sender, EventArgs e) { FrmInputs frm = new FrmInputs("输入数据库密码", new string[] { "Cache密码" }, new Dictionary <string, HZH_Controls.TextInputType>() { { "Cache密码", HZH_Controls.TextInputType.NotControl } }, new Dictionary <string, string>() { }, new Dictionary <string, KeyBoardType>() { { "Cache密码", KeyBoardType.UCKeyBorderAll_EN } }, new List <string>() { "Cache密码" }); frm.ShowDialog(this); if (frm.DialogResult == DialogResult.OK) { Properties.Settings.Default.FileConnectLIS = FileConnectLIS.Checked; Properties.Settings.Default.FileClassMethod = FileClassMethod.Text; Properties.Settings.Default.FileMI = MachineID.Text; Properties.Settings.Default.CacheHost = HostandPort.Text.Split(':')[0]; Properties.Settings.Default.CachePort = HostandPort.Text.Split(':')[1]; Properties.Settings.Default.CacheNamespace = Namespace.Text; Properties.Settings.Default.CacheUserID = UserID.Text; Properties.Settings.Default.CachePassword = frm.Values[0]; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); ucPanelTitle1.IsExpand = false; } }
private void tvMenu_AfterSelect(object sender, TreeViewEventArgs e) { panControl.Controls.Clear(); string strName = e.Node.Text.Trim(); this.Title = "HZHControls控件库DEMO--" + strName; switch (strName) { case "关于授权": AddControl(new UCShouQuan()); break; #region 窗体 English:forms case "提示窗体": if (FrmDialog.ShowDialog(this, "是否再显示一个没有取消按钮的提示框?", "模式窗体测试", true) == System.Windows.Forms.DialogResult.OK) { FrmDialog.ShowDialog(this, "这是一个没有取消按钮的提示框", "模式窗体测试"); } break; case "多输入窗体": FrmInputs frm = new FrmInputs("动态多输入窗体测试", new string[] { "姓名", "电话", "身份证号", "住址" }, new Dictionary <string, HZH_Controls.TextInputType>() { { "电话", HZH_Controls.TextInputType.Regex }, { "身份证号", HZH_Controls.TextInputType.Regex } }, new Dictionary <string, string>() { { "电话", "^1\\d{0,10}$" }, { "身份证号", "^\\d{0,18}$" } }, new Dictionary <string, KeyBoardType>() { { "电话", KeyBoardType.UCKeyBorderNum }, { "身份证号", KeyBoardType.UCKeyBorderNum } }, new List <string>() { "姓名", "电话", "身份证号" }); frm.ShowDialog(this); break; case "气泡提示窗体": FrmTips.ShowTipsError(this, "Error提示信息"); FrmTips.ShowTipsInfo(this, "Info提示信息"); FrmTips.ShowTipsSuccess(this, "Success提示信息"); FrmTips.ShowTipsWarning(this, "Warning提示信息"); FrmTips.ShowTips(this, "自定义提示信息", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success); break; case "有返回的窗体": new FrmTestFrmBack().ShowDialog(this); break; case "等待窗体": ControlHelper.ThreadRunExt(this, () => { Thread.Sleep(5000); ControlHelper.ThreadInvokerControl(this, () => { FrmTips.ShowTipsSuccess(this, "FrmWaiting测试"); }); }, null, this); break; case "仅有标题的窗体": new FrmWithTitleTest().ShowDialog(this); break; case "确定取消窗体1": new FrmOKCancel1Test().ShowDialog(this); break; case "确定取消窗体2": new FrmOKCancel2Test().ShowDialog(this); break; case "资源加载窗体": FrmTestLoading frmLoading = new FrmTestLoading(); frmLoading.BackgroundWorkAction = delegate() { try { frmLoading.CurrentMsg = new KeyValuePair <int, string>(1, "正在初始化配置..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(10, "正在加载第一个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(20, "正在加载第二个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(30, "正在加载第三个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(40, "正在加载第四个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(50, "正在加载第五个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(60, "正在加载第六个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(70, "正在加载第七个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(80, "正在加载第八个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(90, "正在加载第九个资源..."); Thread.Sleep(1000); frmLoading.CurrentMsg = new KeyValuePair <int, string>(1000, "数据加载完成..."); Thread.Sleep(1000); } catch (Exception ex) { MessageBox.Show("加载资源时出现错误"); } }; frmLoading.ShowDialog(); break; #endregion #region 控件 English:control case "表单控件": AddControl(new UC.UCTestForms()); break; case "按钮": AddControl(new UC.UCTestBtns()); break; case "选项卡": AddControl(new UC.UCTestTab()); break; case "树": AddControl(new UC.UCTestTreeview() { Dock = DockStyle.Left }); break; case "列表": AddControl(new UC.UCTestList() { Dock = DockStyle.Left }); break; case "平铺列表": AddControl(new UC.UCTestListView() { Dock = DockStyle.Fill }); break; case "垂直导航": AddControl(new UC.UCTestMenu() { Dock = DockStyle.Left }); break; case "横向列表": AddControl(new UC.UCTestHorizontalList()); break; case "分页控件": AddControl(new UC.UCTestPage()); break; case "表格": AddControl(new UC.UCTestGridTable()); break; case "表格-自定义单元格": AddControl(new UC.UCTestGridTableCustom()); break; case "树表格": AddControl(new UC.UCTestTreeGridTable()); break; case "进度条": AddControl(new UC.UCTestProcess() { Dock = DockStyle.Fill }); break; case "步骤控件": AddControl(new UC.UCTestStep() { Dock = DockStyle.Fill }); break; case "面包屑导航": AddControl(new UC.UCTestNavigation() { Dock = DockStyle.Fill }); break; case "文字提示": AddControl(new UC.UCTestTips() { Dock = DockStyle.Fill }); break; case "滚动文字": AddControl(new UC.UCTestRollText() { Dock = DockStyle.Fill }); break; case "滑块": AddControl(new UC.UCTestTrackbar() { Dock = DockStyle.Fill }); break; case "水波": AddControl(new UC.UCTestWave() { Dock = DockStyle.Fill }); break; case "有标题的面板": AddControl(new UC.UCTestPanelTitle() { Dock = DockStyle.Left }); break; case "图标": AddControl(new UC.UCTestIcon() { Dock = DockStyle.Fill }); break; case "滚动条": AddControl(new UC.UCTestScrollbar() { Dock = DockStyle.Fill }); break; case "控件水印": AddControl(new UC.UCTestGraphicalOverlay()); break; case "表单验证": AddControl(new UC.UCTestVerification() { Dock = DockStyle.Fill }); break; case "图片采样控件": AddControl(new UC.UCTestSampling()); break; case "倒影": AddControl(new UC.UCTestShadow()); break; case "内置颜色": AddControl(new UC.UCTestColors()); break; case "导航菜单": AddControl(new UC.UCTestNavigationMenu()); break; case "扩展导航菜单": AddControl(new UC.UCTestNavigationMenuExt()); break; case "类Office导航菜单": AddControl(new UC.UCTestNavigationMenuOffice()); break; case "分割线标签": AddControl(new UC.UCTestSplitLabel()); break; case "时间轴": AddControl(new UC.UCTestTimeLine() { Dock = DockStyle.Fill }); break; case "穿梭框": AddControl(new UC.UCTestTransfer()); break; case "引用区块": AddControl(new UC.UCTestPanelQuote()); break; case "右键菜单": AddControl(new UC.UCTestContextMenu()); break; #endregion #region 图表 English:Chart case "组织结构图": AddControl(new UC.UCTestMindMapping() { Dock = DockStyle.Fill }); break; case "滚动图表": AddControl(new UC.UCTestWaveChart() { Dock = DockStyle.Fill }); break; case "雷达图": AddControl(new UC.UCTestRadarChart() { Dock = DockStyle.Fill }); break; case "金字塔图": AddControl(new UC.UCTestFunnelChart()); break; case "Live Charts": AddControl(new UC.UCTestLiveCharts()); break; #endregion #region 工业 English:Industry case "LED文字": AddControl(new UC.UCTestLED() { Dock = DockStyle.Fill }); break; case "仪表": AddControl(new UC.UCTestMeter()); break; case "管道": AddControl(new UC.UCTestConduit()); break; case "阀门": AddControl(new UC.UCTestValve()); break; case "鼓风机": AddControl(new UC.UCTestBlower()); break; case "传送带": AddControl(new UC.UCTestConveyor()); break; case "警示灯": AddControl(new UC.UCTestSignalLamp()); break; case "箭头": AddControl(new UC.UCTestArrow()); break; case "温度计": AddControl(new UC.UCTestThermometer()); break; case "转子": AddControl(new UC.UCTestRotor()); break; case "多通道转盘": AddControl(new UC.UCTestDialAisle()); break; case "转盘": AddControl(new UC.UCTestTurntable()); break; #endregion } }
private void tvMenu_AfterSelect(object sender, TreeViewEventArgs e) { panControl.Controls.Clear(); string strName = e.Node.Text.Trim(); switch (strName) { #region 窗体 English:forms case "提示窗体": if (FrmDialog.ShowDialog(this, "是否再显示一个没有取消按钮的提示框?", "模式窗体测试", true) == System.Windows.Forms.DialogResult.OK) { FrmDialog.ShowDialog(this, "这是一个没有取消按钮的提示框", "模式窗体测试"); } break; case "多输入窗体": FrmInputs frm = new FrmInputs("动态多输入窗体测试", new string[] { "姓名", "电话", "身份证号", "住址" }, new Dictionary <string, HZH_Controls.TextInputType>() { { "电话", HZH_Controls.TextInputType.Regex }, { "身份证号", HZH_Controls.TextInputType.Regex } }, new Dictionary <string, string>() { { "电话", "^1\\d{0,10}$" }, { "身份证号", "^\\d{0,18}$" } }, new Dictionary <string, KeyBoardType>() { { "电话", KeyBoardType.UCKeyBorderNum }, { "身份证号", KeyBoardType.UCKeyBorderNum } }, new List <string>() { "姓名", "电话", "身份证号" }); frm.ShowDialog(this); break; case "气泡提示窗体": FrmTips.ShowTipsError(this, "Error提示信息"); FrmTips.ShowTipsInfo(this, "Info提示信息"); FrmTips.ShowTipsSuccess(this, "Success提示信息"); FrmTips.ShowTipsWarning(this, "Warning提示信息"); FrmTips.ShowTips(this, "自定义提示信息", 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 50), TipsState.Success); break; case "有返回的窗体": new FrmTestFrmBack().ShowDialog(this); break; case "等待窗体": ControlHelper.ThreadRunExt(this, () => { Thread.Sleep(5000); ControlHelper.ThreadInvokerControl(this, () => { FrmTips.ShowTipsSuccess(this, "FrmWaiting测试"); }); }, null, this); break; case "仅有标题的窗体": new FrmWithTitleTest().ShowDialog(this); break; case "确定取消窗体1": new FrmOKCancel1Test().ShowDialog(this); break; case "确定取消窗体2": new FrmOKCancel2Test().ShowDialog(this); break; #endregion #region 控件 English:control case "表单控件": AddControl(new UC.UCTestForms()); break; case "按钮": AddControl(new UC.UCTestBtns()); break; case "选项卡": AddControl(new UC.UCTestTab()); break; case "树": AddControl(new UC.UCTestTreeview() { Dock = DockStyle.Left }); break; case "列表": AddControl(new UC.UCTestList() { Dock = DockStyle.Left }); break; case "平铺列表": AddControl(new UC.UCTestListView() { Dock = DockStyle.Fill }); break; case "垂直导航": AddControl(new UC.UCTestMenu() { Dock = DockStyle.Left }); break; case "横向列表": AddControl(new UC.UCTestHorizontalList()); break; case "分页控件": AddControl(new UC.UCTestPage()); break; case "表格": AddControl(new UC.UCTestGridTable() { Dock = DockStyle.Fill }); break; case "树表格": AddControl(new UC.UCTestTreeGridTable() { Dock = DockStyle.Fill }); break; case "进度条": AddControl(new UC.UCTestProcess() { Dock = DockStyle.Fill }); break; case "步骤控件": AddControl(new UC.UCTestStep() { Dock = DockStyle.Fill }); break; case "面包屑导航": AddControl(new UC.UCTestNavigation() { Dock = DockStyle.Fill }); break; case "文字提示": AddControl(new UC.UCTestTips() { Dock = DockStyle.Fill }); break; case "滚动文字": AddControl(new UC.UCTestRollText() { Dock = DockStyle.Fill }); break; case "滑块": AddControl(new UC.UCTestTrackbar() { Dock = DockStyle.Fill }); break; case "水波": AddControl(new UC.UCTestWave() { Dock = DockStyle.Fill }); break; case "有标题的面板": AddControl(new UC.UCTestPanelTitle() { Dock = DockStyle.Left }); break; case "图标": AddControl(new UC.UCTestIcon() { Dock = DockStyle.Fill }); break; #endregion #region 图表 English:Chart case "组织结构图": AddControl(new UC.UCTestMindMapping() { Dock = DockStyle.Fill }); break; case "柱状图": AddControl(new UC.UCTestBarcharts()); break; case "滚动图表": AddControl(new UC.UCTestWaveChart() { Dock = DockStyle.Fill }); break; #endregion #region 工业 English:Industry case "LED文字": AddControl(new UC.UCTestLED() { Dock = DockStyle.Fill }); break; case "仪表": AddControl(new UC.UCTestMeter()); break; case "管道": AddControl(new UC.UCTestConduit()); break; case "阀门": AddControl(new UC.UCTestValve()); break; case "鼓风机": AddControl(new UC.UCTestBlower()); break; case "传送带": AddControl(new UC.UCTestConveyor()); break; case "警示灯": AddControl(new UC.UCTestSignalLamp()); break; case "箭头": AddControl(new UC.UCTestArrow()); break; case "温度计": AddControl(new UC.UCTestThermometer()); break; #endregion } }
private void ucSwitch1_CheckedChanged(object sender, EventArgs e) { Properties.Settings.Default.SerialRTSEnable = ucSwitch1.Checked; Properties.Settings.Default.Save(); FrmTips.ShowTipsSuccess(this, "设置已保存"); }
private void btnSavePoint_Click(object sender, EventArgs e) { pointFiller.FillEntity(AppHelper.ApplyPointSetting); File.WriteAllText(AppHelper.ApplyConfigPath, JsonConvert.SerializeObject(AppHelper.ApplyPointSetting, Formatting.Indented)); FrmTips.ShowTipsSuccess(AppHelper.MainForm, "保存成功", ContentAlignment.MiddleCenter); }