/// <summary> /// Test /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConnTest_Click(object sender, EventArgs e) { //var config = new TemplateServiceConfiguration(); //config.CompilerServiceFactory = new RazorEngine.Roslyn.RoslynCompilerServiceFactory(); //using (var service = RazorEngineService.Create(config)) //{ // string template = "@Model.Name"; // var model0 = new { Name = "Matt" }; // string result0 = service.RunCompile(template, "htmlRawTemplate0", null, model0); //} var model = GetLVSelectConfigModel(); var connTypeValue = Convert.ToInt32(model.ConnType); if (model.ConnString.IsNullOrEmpty() || model.ConnName.IsNullOrEmpty()) { this.ShowWarningDialog("连接字符串或连接名称不可为空"); return; } var result = ConnTestUtil.ConnTest(connTypeValue, model.ConnString); if (!result) { UIMessageTip.ShowError("测试失败", 1000, true); } else { UIMessageTip.ShowOk("测试成功", 1000, true); } }
/// <summary> /// 初始化控制器按钮 /// </summary> void InitButton() { foreach (var btnName in Main._Setting.ControllerButton) { var control = this.GetControl(btnName); if (control is UISymbolButton) { if (control.Name == "btnScreenshot") { control.Click += (sender, e) => { if (ADB.Screenshot()) { UIMessageTip.ShowOk(this, "截图成功!图片保存在桌面FreeControl Screenshot文件夹中。", 2000, false); } }; } else { var keyCode = (KeyCode)Enum.Parse(typeof(KeyCode), btnName.Remove(0, 3)); control.Click += (sender, e) => ADB.ExecuteShell(ADB.GetCommand(keyCode)); } flowPanel.AddControl(control); } } }
private void btnCancel_Click(object sender, EventArgs e) { if (dgvRoomSell.SelectedRows.Count > 0) { if (UIMessageDialog.ShowMessageDialog("你确定要删除该消费记录吗?", UILocalize.WarningTitle, true, Style)) { string time = dgvRoomSell.SelectedRows[0].Cells["clSpendTime"].Value.ToString(); string name = dgvRoomSell.SelectedRows[0].Cells["clSpendName"].Value.ToString(); string price = dgvRoomSell.SelectedRows[0].Cells["clSpendPrice"].Value.ToString(); SellThing s = new SellService().SelectSellThingByNameAndPrice(name, price); decimal num = Convert.ToDecimal(dgvRoomSell.SelectedRows[0].Cells["clSpendAmount"].Value.ToString()); string Stock = (s.Stock + num).ToString(); if (new SellService().DeleteSellThing(txtRoomNo.Text, time) == true) { bool n = new SellService().UpdateSellThing(Stock, s.SellNo); UIMessageTip.ShowOk("撤销成功!", 1000); LoadSpendInfoByRoomNo(txtRoomNo.Text); LoadSellThingInfo(); } } else { UIMessageTip.ShowError("操作取消!", 1000); } } else { MessageBox.Show("请选择要删除的消费记录!", "提示信息"); } }
private void Save_Click(object sender, EventArgs e) { if (uiRadioButton1.Checked && !uiRadioButton2.Checked && !uiRadioButton3.Checked) { AddUpdateAppSettings("Code_rate_control_mode_selection", "1"); } else if (!uiRadioButton1.Checked && uiRadioButton2.Checked && !uiRadioButton3.Checked) { AddUpdateAppSettings("Code_rate_control_mode_selection", "2"); } else if (!uiRadioButton1.Checked && !uiRadioButton2.Checked && uiRadioButton3.Checked) { AddUpdateAppSettings("Code_rate_control_mode_selection", "3"); } else { ShowErrorDialog(@"正常情况看不到这个,出现该弹窗请带上复现方法到GitHub提issue"); } AddUpdateAppSettings("I", IBox.Text); AddUpdateAppSettings("P", PBox.Text); AddUpdateAppSettings("B", BBox.Text); AddUpdateAppSettings("CBR", CBRBox.Text); AddUpdateAppSettings("VBR", VBRBox.Text); AddUpdateAppSettings("Raws_audiobit", AudioBox.Text); UIMessageTip.ShowOk("保存成功"); }
private void NotifyUser(Control control, string information) { Point controlLoc = this.PointToScreen(control.Location); controlLoc.X = controlLoc.X + (control.Width / 2) + 10; controlLoc.Y += 60; UIMessageTip.ShowOk(information, point: controlLoc); }
private void uiSymbolButton13_Click(object sender, EventArgs e) { string dir = ""; if (DirEx.SelectDirEx("扩展打开文件夹", ref dir)) { UIMessageTip.ShowOk(dir); } }
private void uiSymbolButton10_Click(object sender, EventArgs e) { FLogin frm = new FLogin(); frm.ShowDialog(); if (frm.IsLogin) { UIMessageTip.ShowOk("登录成功"); } frm.Dispose(); }
private void btnDbOk_Click(object sender, EventArgs e) { var connString = this.tbConnString.Text; var dbName = this.tbDbName.Text; var dbPath = this.tbDbPath.Text; var savePath = this.tbSavePath.Text; if (connString.IsNullOrWhiteSpace()) { this.ShowWarningDialog("没有设置连接字符串"); return; } if (dbName.IsNullOrWhiteSpace()) { this.ShowWarningDialog("数据库名不可为空"); return; } if (dbPath.IsNullOrWhiteSpace()) { this.ShowWarningDialog("数据库文件不可为空"); return; } if (!File.Exists(dbPath)) { this.ShowWarningDialog("数据库文件不存在"); return; } if (savePath.IsNullOrWhiteSpace()) { this.ShowWarningDialog("保存目录不可为空"); return; } if (!Directory.Exists(savePath)) { this.ShowWarningDialog("保存目录不存在"); return; } var dal = GetDal(this.tbConnString.Text); var dbNameIsExist = dal.IsExistDb(dbName); if (dbNameIsExist) { this.ShowWarningDialog($"数据库:{dbName} 已存在"); return; } dal.RestoreDb(dbName, dbPath, savePath); UIMessageTip.ShowOk("创建成功", 2000, true); }
private void NotifyProfile(Control control, string information, bool isOk) { Point controlLoc = this.PointToScreen(control.Location); controlLoc.X = controlLoc.X + (control.Width / 2) + 10; controlLoc.Y += 160; if (isOk) { UIMessageTip.ShowOk(information, point: controlLoc); } else { UIMessageTip.ShowWarning(information, point: controlLoc); } }
private void uiSymbolButton3_Click(object sender, EventArgs e) { UILoginForm frm = new UILoginForm(); frm.Text = "SunnyUI.Net Login Form"; frm.SubText = "SunnyUI.Net V2.2.5"; frm.OnLogin += Frm_OnLogin; frm.LoginImage = UILoginForm.UILoginImage.Login2; frm.ShowDialog(); if (frm.IsLogin) { UIMessageTip.ShowOk("登录成功"); } frm.Dispose(); }
private void btnTest_Click(object sender, EventArgs e) { if (this.tbConnString.Text.IsNullOrWhiteSpace()) { this.ShowWarningDialog("没有设置连接字符串"); return; } var dal = GetDal(this.tbConnString.Text); var result = dal.TestConnection(); if (!result) { UIMessageTip.ShowError("测试失败", 1000, true); } else { UIMessageTip.ShowOk("测试成功", 1000, true); } }
private void uiSymbolButton3_Click(object sender, EventArgs e) { UILoginForm frm = new UILoginForm { ShowInTaskbar = true, Text = "Login", Title = "SunnyUI.Net Login Form", SubText = Version }; frm.OnLogin += Frm_OnLogin; frm.LoginImage = UILoginForm.UILoginImage.Login2; frm.ShowDialog(); if (frm.IsLogin) { UIMessageTip.ShowOk("登录成功"); } frm.Dispose(); }
private void btnSave_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow row in this.dgv_config.Rows) { var key = row.Cells["key"].Value?.ToString(); var value = row.Cells["value"].Value?.ToString(); if (ConfigUtil.GetAppSettingValue(key, configPath: _configPath).IsNullOrWhiteSpace()) { ConfigUtil.SetConnectionString(key, value, null, configPath: _configPath); } else { ConfigUtil.SetAppSettingValue(key, value, _configPath); } } UIMessageTip.ShowOk("编辑成功", 2000, true); } catch (Exception ex) { this.ShowWarningDialog("编辑失败"); } }
private void uiSymbolButton9_Click(object sender, EventArgs e) { UIMessageTip.ShowOk("轻便消息提示框 - 成功"); }
private void uiNavMenu1_MenuItemClick(System.Windows.Forms.TreeNode node, NavMenuItem item, int pageIndex) { UIMessageTip.ShowOk(node.Text + ", " + pageIndex); }
private void uiNavBar1_MenuItemClick(string itemText, int menuIndex, int pageIndex) { UIMessageTip.ShowOk(itemText + ", " + menuIndex + ", " + pageIndex); }
/// <summary> /// 显示良好消息 /// </summary> /// <param name="form">窗体</param> /// <param name="text">消息文本</param> /// <param name="delay">消息停留时长(ms)。为负时使用全局时长</param> /// <param name="floating">是否漂浮,不指定则使用全局设置</param> /// <param name="point">消息窗显示位置。不指定则智能判定,当由工具栏项(ToolStripItem)弹出时,请指定该参数或使用接收控件的重载</param> /// <param name="centerByPoint">是否以point参数为中心进行呈现。为false则是在其附近呈现</param> public static void ShowSuccessTip(this Form form, string text = null, int delay = -1, bool?floating = null, Point?point = null, bool centerByPoint = false) => UIMessageTip.ShowOk(text, delay, floating, point, centerByPoint);
private void btnClear_Click_1(object sender, EventArgs e) { richTBLog.Text = ""; richTBLog.ScrollToCaret(); UIMessageTip.ShowOk("Clear Log OK", 1000, true); }
private void btnSiteOK_Click(object sender, EventArgs e) { if (!this.iisManager.IsInstallIIS()) { this.ShowWarningDialog("服务器尚未安装IIS服务模块"); return; } //if (IISHelp.GetIISVersion() < 0) //{ // this.ShowWarningDialog("没有安装 IIS 环境"); // return; //} if (!NetFrameWorkHelp.IsExistNet40()) { this.ShowWarningDialog("没有 NET4.0 环境"); return; } Dictionary <string, string> mimeDic = new Dictionary <string, string>(); mimeDic.Add(".woff2", "application/x-font-woff"); mimeDic.Add(".woff", "application/x-font-woff"); //IISHelp.AddMIMEType(mimeDic); var siteName = this.tbSiteName.Text; if (siteName.IsNullOrWhiteSpace()) { this.ShowWarningDialog("应用名为空"); return; } if (iisManager.IsExistSiteName(siteName)) { this.ShowWarningDialog($"应用名:{siteName} 已被使用"); return; } var poolName = this.tbPoolName.Text; if (poolName.IsNullOrWhiteSpace()) { this.ShowWarningDialog("程序池名为空"); return; } if (iisManager.IsExistPoolName(poolName)) { this.ShowWarningDialog($"名称:{poolName}已被使用"); return; } var port = this.tbPort.Text; if (port.IsNullOrWhiteSpace()) { this.ShowWarningDialog("端口号为空"); return; } if (!port.IsNumeric()) { this.ShowWarningDialog("端口号只能为数字"); return; } if (PortHelper.PortInUse(Convert.ToInt32(port))) { this.ShowWarningDialog($"{port}端口号已被占用"); return; } var sitePath = this.tbSitePath.Text; if (sitePath.IsNullOrWhiteSpace()) { this.ShowWarningDialog("应用路径不可为空"); return; } if (!Directory.Exists(sitePath)) { this.ShowWarningDialog("应用路径不存在"); return; } var result = iisManager.CreateWebSite(siteName, poolName, sitePath, Convert.ToInt32(port), mimeDic, GetPoolMode()); if (result) { UIMessageTip.ShowOk("发布成功", 2000, true); } else { this.ShowWarningDialog("发布失败"); } }
/// <summary> /// 在指定控件附近显示良好消息 /// </summary> /// <param name="form">窗体</param> /// <param name="controlOrItem">控件或工具栏项</param> /// <param name="text">消息文本</param> /// <param name="delay">消息停留时长(ms)。为负时使用全局时长</param> /// <param name="floating">是否漂浮,不指定则使用全局设置</param> /// <param name="centerInControl">是否在控件中央显示,不指定则自动判断</param> public static void ShowSuccessTip(this Form form, Component controlOrItem, string text = null, int delay = -1, bool?floating = null, bool?centerInControl = null) => UIMessageTip.ShowOk(controlOrItem, text, delay, floating, centerInControl);
/// <summary> /// 导出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBuild_Click(object sender, EventArgs e) { _savePath = this.tbSavePath.Text; if (_savePath.IsNullOrWhiteSpace()) { this.ShowWarningDialog("没有设置导出目录"); return; } var templatePath = this.cbbTemplate.SelectedValue?.ToString(); if (templatePath.IsNullOrWhiteSpace()) { this.ShowWarningDialog("没有选择模板"); return; } var configIndex = this.cbbConfig.SelectedIndex; if (configIndex < 0) { this.ShowWarningDialog("没有选择配置"); return; } var configModel = jsonUtil.Items[configIndex]; var nameSpace = this.tbNameSapce.Text; if (nameSpace.IsNullOrWhiteSpace()) { this.ShowWarningDialog("没有添加命名空间"); return; } IDbDal dal = null; if (configModel.ConnType == ((int)DbBuildEntity.Util.Enums.DbType.SqlServer).ToString()) { dal = new SqlServerDal(); } else if (configModel.ConnType == ((int)DbBuildEntity.Util.Enums.DbType.Oracle).ToString()) { dal = new OracleDal(); } else if (configModel.ConnType == ((int)DbBuildEntity.Util.Enums.DbType.MySQL).ToString()) { } else if (configModel.ConnType == ((int)DbBuildEntity.Util.Enums.DbType.SQlite).ToString()) { dal = new SqliteDal(); } var tables = dal.GetTables(configModel.ConnString); int index = 0; if (Path.GetFileNameWithoutExtension(templatePath) != "实体枚举模板") { ShowStatus("提示", "导出实体中......", tables.Count, 0); foreach (var table in tables) { //StatusDescription = "导出实体中(" + index + "%)......"; StatusStepIt(); var columnsList = dal.GetColumnList(table.TableName, configModel.ConnString); foreach (var column in columnsList) { if (column.TypeName.Contains("varchar") || column.TypeName.Contains("VARCHAR")) { column.TypeName = "string"; } string value = string.Empty; var dResult = dbTypeDic.TryGetValue(column.TypeName.ToUpper(), out value); if (dResult) { column.TypeName = value; } else { column.TypeName = "object"; } } //var buildContent = RazorBuildUtil.GetBuildContent(templatePath, columnsList, table); var buildContent = RazorBuildUtil.GetBuildContentNew(templatePath, table.TableName, columnsList, table, nameSpace); FileUtil.Save(buildContent, Path.Combine(_savePath, $"{table.TableName}.cs")); index++; } } else { ShowStatus("提示", "加载数据中......", tables.Count, 0); List <TableModels> list = new List <TableModels>(); TableModels model = null; foreach (var table in tables) { //StatusDescription = "加载数据中(" + index + "%)......"; StatusStepIt(); var columnsList = dal.GetColumnList(table.TableName, configModel.ConnString); model = new TableModels(); model.Columns = columnsList; model.TableName = table.TableName; model.Description = table.Description; list.Add(model); index++; } var buildContent = RazorBuildUtil.GetBuildContent_Enum(templatePath, "TableNames", list, nameSpace, "TableNames"); FileUtil.Save(buildContent, Path.Combine(_savePath, "TableNames.cs")); } ConfigUtil.SetAppSettingValue("DefaultPath", _savePath, Global.nameSpaceConfigFullPath); UIMessageTip.ShowOk("导出成功", 2000, true); }