private void comboBoxSelectLang_SelectedIndexChanged(Object sender, EventArgs e) { // 重新记录语言信息,并写入配置文件 var lang = BstManager.Instance.LanguageTypes[this.comboBoxSelectLang.SelectedIndex]; BstManager.Instance.SystemSettings["lang"] = lang; BstManager.WriteJsonFile(BstManager.PathJsonSettings, BstManager.Instance.SystemSettings); // 显示重启程序提示信息 // 这一段因为关系到语言的设定,使用双语显示,不作为配置设定 BstManager.DisplayInfoMessageBox( "重启以生效改动 / Restart to activate the setting change", "你需要手动重启应用程序,来应用当前改动的语言配置!\r\n" + "You have to restart the application manually, to activate the language setting change!" ); }
private void btnReportIssue_Click(Object sender, EventArgs e) { // 获得数据 var originInfo = this.textBoxOrigin.Text; var targetInfo = this.textBoxTarget.Text; var consoleInfo = this.textBoxOut.Text; // 检查数据 if (string.IsNullOrEmpty(originInfo)) { BstManager.DisplayErrorMessageBox( this._i18N.LoadI18NValue("GuiItems", "actionReportErrorTitle"), this._i18N.LoadI18NValue("GuiItems", "actionSelectOriginErrorMsg") ); return; } if (string.IsNullOrEmpty(targetInfo)) { BstManager.DisplayErrorMessageBox( this._i18N.LoadI18NValue("GuiItems", "actionReportErrorTitle"), this._i18N.LoadI18NValue("GuiItems", "actionSelectTargetErrorMsg") ); return; } var hasGruntRunSign = false; for (var lineNo = 0; lineNo < this.textBoxOut.Lines.Length; lineNo++) { var lineText = this.textBoxOut.Lines[lineNo]; if (lineText.Contains(BstManager.GruntRunSign)) { hasGruntRunSign = true; break; } } if (!hasGruntRunSign) { BstManager.DisplayErrorMessageBox( this._i18N.LoadI18NValue("GuiItems", "actionReportErrorTitle"), this._i18N.LoadI18NValue("GuiItems", "actionReportErrorMsg") ); return; } // 发送报告 using (var wb = new WebClient()) { var data = new NameValueCollection(); data["origin"] = originInfo; data["target"] = targetInfo; data["console"] = consoleInfo; var response = wb.UploadValues(BstManager.BstReportServerUrl, "POST", data); var responseStr = System.Text.Encoding.ASCII.GetString(response, 0, response.Length); if (Regex.IsMatch(responseStr, BstManager.BstReportAlreadyExists)) { responseStr = responseStr.Substring(3); // remove prefix "-3|" BstManager.DisplayInfoMessageBox( this._i18N.LoadI18NValue("GuiItems", "reportErrorTitle"), string.Format(this._i18N.LoadI18NValue("GuiItems", "reportAlreadyExists"), responseStr) ); } else { switch (responseStr) { case BstManager.BstReportMissingInfo: BstManager.DisplayErrorMessageBox( this._i18N.LoadI18NValue("GuiItems", "reportErrorTitle"), this._i18N.LoadI18NValue("GuiItems", "reportMissingInfo") ); break; case BstManager.BstReportInvalidJson: BstManager.DisplayErrorMessageBox( this._i18N.LoadI18NValue("GuiItems", "reportErrorTitle"), this._i18N.LoadI18NValue("GuiItems", "reportInvalidJson") ); break; default: BstManager.DisplayInfoMessageBox( this._i18N.LoadI18NValue("GuiItems", "reportSucceedTitle"), string.Format(this._i18N.LoadI18NValue("GuiItems", "reportSucceedMsg"), responseStr) ); break; } } } }