private void Page_Loaded(object sender, RoutedEventArgs e) { openHuoJian.Click = new DelegateCommand((x) => { AyMessageBox.ShowInformation("小火箭已经开启!"); }); }
void Current_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { AyMessageBox.Show(e.Exception.Message, MessageBoxButton.OK, AyMessageBoxImage.Error); AyMessageBox.Show("我们很抱歉,当前应用程序遇到一些问题,该操作已经终止,请进行重试,如果问题继续存在,请联系符文之地-九命喵式微", "意外的操作"); //这里通常需要给用户一些较为友好的提示,并且后续可能的操作 Log.LogError("未知错误", e.Exception); e.Handled = true; //使用这一行代码告诉运行时,该异常被处理了,不再作为UnhandledException抛出了。 }
public ToolBoxController() : base() { OpenClickCommand = new DelegateCommand((x) => { AyMessageBox.ShowInformation("谢谢你的留言"); }); }
public override void DoCloseWindow() { if (CloseIsHideWindow) { this.Hide(); } else { try { if (!ComfirmBeforeClose) { this.Close(); } else { if (MessageBoxResult.OK == AyMessageBox.ShowQuestionOkCancel(Langs.ay_ConfirmWhenExitApp.Lang(), Langs.share_remind.Lang())) { this.Close(); } } } catch { } } }
public void SknConverter(string sknfile) { if (string.IsNullOrWhiteSpace(sknfile) && !File.Exists(sknfile)) { AyMessageBox.Show("文件不存在,请重新选择!", "文件不存在!"); return; } try { var sklfile = Path.ChangeExtension(sknfile, ".skl"); var skn = new SknFile(sknfile) { Version = 2 }; skn.SaveFile(FileOperations.NewFilePath(sknfile)); if (!string.IsNullOrWhiteSpace(sklfile) && File.Exists(sklfile)) { File.Copy(sklfile, FileOperations.NewFilePath(sklfile), true); } } catch { AyMessageBox.Show("文件读取失败!请确认", "文件错误!"); } }
private void 获取皮肤信息() { var skinconfig = Zip.UnZipOneFile(FilePath, "skin.cfg"); if (skinconfig != null) { Skin = Config.SkinConfigGet(skinconfig) ?? new Skin(); } else { DialogHero spw = new DialogHero(); spw.ShowDialog(); if (spw.DialogResult == true) { Skin.Hero = spw.HeroName; } else { AyMessageBox.ShowCus("未能正常识别皮肤英雄!皮肤导入失败", "识别失败"); _canGoOn = false; } } if (string.IsNullOrEmpty(Skin.SkinName)) { Skin.SkinName = Path.GetFileNameWithoutExtension(FilePath); } if (string.IsNullOrEmpty(Skin.FileName)) { Skin.FileName = Path.GetFileName(FilePath); } }
private void 检查数据完整性() { WriteTitle("数据完整性检查...."); FileOperations.CreateDir(Game.SkinPath); var skincount = _lumei.CheckMountSkin(); if (skincount > 0) { var isReBuild = AyMessageBox.Show(string.Format("当前客户端存在{0}条空挂载记录{1}是否清除?", skincount, Environment.NewLine), "挂载文件异常", MessageBoxButton.YesNo) == MessageBoxResult.Yes; if (isReBuild) { if (_lumei.ClearCheckSkin()) { WriteMessage("数据清理成功!"); WriteMessage(string.Format("共清理{0}条无效数据!", skincount)); WriteMessage("数据完整性检查完成"); } else { AyMessageBox.Show("请确认程序拥有足够权限或游戏未运行", "清理失败"); WriteMessage("清理失败!"); WriteMessage("数据完整性检查失败"); State = false; } } } else { WriteMessage("数据完整性检查完成"); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { txt_db_host.Text = db_host = Global.cu.IniReadValue("DBConfig", "db_host"); txt_db_port.Text = db_port = Global.cu.IniReadValue("DBConfig", "db_port"); txt_db_name.Text = db_name = Global.cu.IniReadValue("DBConfig", "db_name"); txt_db_username.Text = db_username = Global.cu.IniReadValue("DBConfig", "db_username"); txt_db_password.Text = db_password = Global.cu.IniReadValue("DBConfig", "db_password"); if (StringUtil.isBlank(db_host)) { AyMessageBox.ShowError("数据库地址不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_port)) { AyMessageBox.ShowError("数据库端口不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_name)) { AyMessageBox.ShowError("数据库名称不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_username)) { AyMessageBox.ShowError("数据库账号不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_password)) { AyMessageBox.ShowError("数据库密码不能为空或配置文件数据异常!"); return; } }
private void openPromt_Click(object sender, RoutedEventArgs e) { AyMessageBox.Promt((text) => { AyMessageBox.ShowInformation(winThis, "你刚刚输入的是:{0}".StringFormat(text)); }, "等待你的输入..."); }
private void ReInstall(object sender, RoutedEventArgs e) { // if (NavigationService != null) NavigationService.Navigate(new PageSet()); if (AyMessageBox.ShowCus("是否要重新挂载全部皮肤?", "重新挂载", "/Resources/logo.png", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { _softParam.ReInstall(); } }
private void AllUninstall(object sender, RoutedEventArgs e) { if (AyMessageBox.ShowCus("是否要卸载全部皮肤?", "卸载全部", "/Resources/logo.png", MessageBoxButton.YesNo) != MessageBoxResult.Yes) { return; } _softParam.AllUninstall(); }
private void BackSkin(object sender, System.Windows.RoutedEventArgs e) { if (Changed && AyMessageBox.Show("您已修改了本英雄信息,是否保存?", "已被修改", System.Windows.MessageBoxButton.YesNo) == System.Windows.MessageBoxResult.Yes) { AyMessageBox.Show("OK", "OK"); } _soft.BackPageSkin(); }
private void 保存皮肤信息() { Comment = "保存皮肤信息"; if (State == 1) { AyMessageBox.ShowCus("皮肤 " + Skin.SkinName + " 导入成功", "导入成功!", Picture.HeroSquarePath(Skin.Hero)); _skin.SaveOrEdit(Skin); _softParam.BackPageHero(); } }
public void Initialize() { try { InitDic(); } catch (System.Exception ex) { AyMessageBox.ShowError(ex.Message); } }
private void 查看压缩包结构() { ZipFiles = Zip.GetZipFilesName(FilePath); if (!ZipFiles.Any(a => a.ToLower().Contains("data")) || ZipFiles.Any(a => a.ToLower().Contains("lol_game_client"))) { if (AyMessageBox.ShowCus(string.Format("皮肤包结构异常,可能为未整理过的美服皮肤包{0}是否使用自动整理功能?", Environment.NewLine), "皮肤包异常", "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { 重新整理皮肤包(); } } }
/// <summary> /// 打开文件 /// </summary> /// <param name="filepath"></param> public static void OpenFile(string filepath) { if (File.Exists(filepath) || Directory.Exists(filepath)) { Process.Start(filepath); } else { AyMessageBox.ShowCus("文件:" + filepath + " 不存在!", "文件不存在!", "/Resources/logo.png"); } }
private void Sure(object sender, RoutedEventArgs e) { if (HeroList.SelectedIndex == -1 || HeroList.SelectedItem == null) { AyMessageBox.ShowCus("Message", "Title"); return; } var item = (Hero)HeroList.SelectedItem; HeroName = item.EnName; this.DialogResult = true; }
public static MessageBoxResult ShowCus(Window owner, string message, string title = "", string iconUri = "", MessageBoxButton button = MessageBoxButton.OK, MessageBoxResult defaultResult = MessageBoxResult.None) { var result = Application.Current.Dispatcher.Invoke(new Func <MessageBoxResult>(() => { var messageBox = new AyMessageBox(owner, message, title, button, iconUri, defaultResult, MessageBoxOptions.None); messageBox.ShowDialog(); return(messageBox.MessageBoxResult); })); return((MessageBoxResult)result); }
public static void ShowMessageBox(this CommonReturnDTO returnDTO, Window owner = null) { //查找aylayer if (returnDTO.IsSuccess) { AyMessageBox.ShowRight(owner, GetMessageByType(returnDTO), Langs.share_tip.Lang()); } else if (returnDTO.Error != null) { AyMessageBox.ShowError(owner, GetMessageByType(returnDTO), Langs.share_tip.Lang()); } else { AyMessageBox.ShowInformation(owner, GetMessageByType(returnDTO), Langs.share_tip.Lang()); } }
public static MessageBoxResult Show(Window owner, string message, Action closeAction, string title = "", MessageBoxButton button = MessageBoxButton.OK, AyMessageBoxImage icon = AyMessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None, MessageBoxOptions options = MessageBoxOptions.None) { var result = Application.Current.Dispatcher.Invoke(new Func <MessageBoxResult>(() => { var messageBox = new AyMessageBox(owner, message, title, button, icon, defaultResult, options, closeAction, null, 1); messageBox.ShowDialog(); return(messageBox.MessageBoxResult); })); return((MessageBoxResult)result); }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SkinDelete(object sender, RoutedEventArgs e) { if (SkinList.SelectedIndex < 0) { return; } var skin = (Skin)SkinList.SelectedItem; if (AyMessageBox.ShowCus("确认要删除皮肤 " + skin.SkinName + " 吗?", "确认删除", "/Resources/logo.png", MessageBoxButton.YesNo) == MessageBoxResult.No) { return; } UpdateSkinList(skin); _soft.SetBackImage(skin.Hero); GC.Collect(); _lumei.SkinDelete(skin); }
private void PictureToLoadImage(string picpath) { try { FileOperations.CreateDirWithDelete(Soft.ZipTempPath("Load")); var temppath = Soft.ZipTempPath("Load") + "Load.png"; if (!FileOperations.CreateFileDir(temppath)) { return; } var model = new Skin { Hero = "SRBackground" }; model.SkinName = Path.GetFileNameWithoutExtension(picpath); model.FileName = model.SkinName + ".zip"; model.BackImage = "load.png"; var loadpath = Soft.ZipTempPath("Load") + "DATA\\LoadingScreen\\SRBackground.dds"; CutPic(picpath, temppath); //if (Directory.Exists(Soft.ZipTempPath("Load"))) // Directory.Delete(Soft.ZipTempPath("Load"),true); FileOperations.CreateFileDir(loadpath); var pic = DevIL.DevIL.LoadBitmap(temppath); if (pic == null) { AyMessageBox.Show("图片读取失败!\r\n此图片无法被导入!\r\n原因:我也不知道为啥导入不能……", "读取失败"); return; } DevIL.DevIL.SaveBitmap(loadpath, pic); loadpath = Soft.ZipTempPath("LoadTemp"); FileOperations.CreateDirWithDelete(loadpath); Zip.ZipFile(Soft.ZipTempPath("Load"), loadpath + model.FileName); var savepath = Soft.SkinFile(model); FileOperations.CreateFileDir(savepath); File.Copy(loadpath + model.FileName, savepath, true); File.Copy(temppath, Soft.SkinPath(model) + "load.png", true); //TODO 重新整理文件 _skin.Add(model); AyMessageBox.Show("载入图 " + model.SkinName + " 导入成功!", "导入成功"); _softParam.BackPageSkin(); } catch (Exception ex) { AyMessageBox.Show("载入图导入失败\r\n请重新尝试\r\n或错误原因请查看错误日志!", "载入图导入失败!"); Log.LogError("载入图导入失败", ex); } }
private void 解压压缩包的图片() { Comment = "解压压缩包的图片"; TempPath = Soft.ZipTempPath(Skin.Hero); FileOperations.CreateDir(TempPath); var files = ZipFiles.Where(d => d != null && (d.EndsWith(".dds") || d.EndsWith(".png") || d.EndsWith(".jpg") || d.EndsWith(".jpeg") || d.EndsWith(".bmp")) && !d.ToLower().Contains("particles")).ToList(); try { Zip.UnzipFiles(FilePath, TempPath, files); files = FileOperations.AllFiles(TempPath); 获取各种图片(files); } catch { AyMessageBox.Show("载入图读取失败!", "压缩包错误!"); } }
private void DialogShow() { if (_time < 5) { _time++; } else { AyMessageBox.Show("错误次数过多,请重新运行程序!", "警告"); State = false; return; } var set = new Set(); var dialog = new FolderBrowserDialog { Description = "选择英雄联盟路径,例:C:\\英雄联盟", ShowNewFolderButton = false }; dialog.ShowDialog(); var gamePath = dialog.SelectedPath; dialog.Dispose(); if (string.IsNullOrWhiteSpace(gamePath)) { AyMessageBox.Show("路径不合法,请重新选择!", "路径错误!"); DialogShow(); } else { gamePath = gamePath + "\\"; if (!File.Exists(gamePath + "Game\\Characters.zip")) { set.State = false; set.Title = "游戏路径错误"; set.Message = string.Format("游戏路径选择错误{0}请重新选择!{0}", Environment.NewLine); AyMessageBox.Show(set.Message, set.Title); DialogShow(); } else { State = Config.GameSave("GamePath", gamePath); } } }
//此方法重写,为了导入AYUI public override void Application_Run(Application appliation) { appliation.AYUI(); db_host = cu.IniReadValue("DBConfig", "db_host"); db_port = cu.IniReadValue("DBConfig", "db_port"); db_name = cu.IniReadValue("DBConfig", "db_name"); db_username = cu.IniReadValue("DBConfig", "db_username"); db_password = cu.IniReadValue("DBConfig", "db_password"); table_name = cu.IniReadValue("TableConfig", "table_name"); if (StringUtil.isBlank(db_host)) { AyMessageBox.ShowError("数据库地址不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_port)) { AyMessageBox.ShowError("数据库端口不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_name)) { AyMessageBox.ShowError("数据库名称不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_username)) { AyMessageBox.ShowError("数据库账号不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(db_password)) { AyMessageBox.ShowError("数据库密码不能为空或配置文件数据异常!"); return; } else if (StringUtil.isBlank(table_name)) { AyMessageBox.ShowError("数据表名称异常!"); return; } my = new MySQLManager(db_host, db_port, db_name, db_username, db_password); my.showStr = false; }
private void CheckFile(string file) { var ex = Path.GetExtension(file).ToLower(); // var ex = Path.GetExtension(file)?.ToLower(); switch (ex) { case ".skn": _lumei.SknConverter(file); break; case ".zip": var imp = new SkinImport(); imp.StartImport(file); break; default: AyMessageBox.Show("无法识别此文件格式!", "未知格式"); break; } }
private void btn_save_Click(object sender, RoutedEventArgs e) { if (StringUtil.isBlank(txt_db_host.Text)) { AyMessageBox.ShowError("数据库地址不能为空!"); return; } else if (StringUtil.isBlank(txt_db_port.Text)) { AyMessageBox.ShowError("数据库端口不能为空!"); return; } else if (StringUtil.isBlank(txt_db_name.Text)) { AyMessageBox.ShowError("数据库名称不能为空!"); return; } else if (StringUtil.isBlank(txt_db_username.Text)) { AyMessageBox.ShowError("数据库账号不能为空!"); return; } else if (StringUtil.isBlank(txt_db_password.Text)) { AyMessageBox.ShowError("数据库密码不能为空!"); return; } Global.cu.IniWriteValue("DBConfig", "db_host", txt_db_host.Text); Global.cu.IniWriteValue("DBConfig", "db_port", txt_db_port.Text); Global.cu.IniWriteValue("DBConfig", "db_name", txt_db_name.Text); Global.cu.IniWriteValue("DBConfig", "db_username", txt_db_username.Text); Global.cu.IniWriteValue("DBConfig", "db_password", txt_db_password.Text); Global.RefreshConfigDataToGloBal(); Global.HomeWindow.RefreshTablesNameComBoBox(); Global.configPage = null; AyLayer.Close("ConfigPage".ToLower()); }
internal static MessageBoxResult Promt(Window owner, Action <AyFormInput> init, Action <string> callBack, string title = "", MessageBoxButton button = MessageBoxButton.OKCancel, AyMessageBoxImage icon = AyMessageBoxImage.None, MessageBoxResult defaultResult = MessageBoxResult.None, MessageBoxOptions options = MessageBoxOptions.None) { try { var result = Application.Current.Dispatcher.Invoke(new Func <MessageBoxResult>(() => { string a = null; var messageBox = new AyMessageBox(owner, a, title, button, icon, defaultResult, options, null, init, 1, callBack); messageBox.ShowDialog(); return(messageBox.MessageBoxResult); })); return((MessageBoxResult)result); } catch { return(MessageBoxResult.None); } }
private void 软件更新检查() { WriteTitle("检查更新"); Set = _lumei.CheckUpdate(); if (Set == null) { WriteTitle("更新检查失败!"); WriteMessage("无法连接至服务器!"); } else if (Set.State) { if (AyMessageBox.Show("拥有新版本" + Set.Title + ",是否更新?", "检查更新", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { State = false; this.Dispatcher.BeginInvoke(new Action(() => { _lumei.StartUpdate(); }), null); this.Dispatcher.BeginInvoke(new Action(() => { this.Hide(); }), null); } else { WriteMessage("取消更新!"); } } }
private void 检查重复皮肤() { var skins = _skin.AllSkins(); if (skins.Any(d => d.SkinName == Skin.SkinName && d.Hero == Skin.Hero)) { switch (AyMessageBox.Show("已存在名字为 " + Skin.SkinName + " 的同名皮肤,是否覆盖保存?\r选择是:将覆盖旧皮肤保存\r选择否:将不覆盖旧皮肤保存\r选择取消:将取消导入", "重复皮肤", MessageBoxButton.YesNoCancel)) { case MessageBoxResult.Yes: Skin = skins.FirstOrDefault(d => d.SkinName == Skin.SkinName); break; case MessageBoxResult.No: Skin.SkinName = Skin.SkinName + "[副本]"; break; default: AyMessageBox.Show("取消对当前皮肤" + Skin.SkinName + "的导入!", "取消导入!"); _canGoOn = false; break; } } }