private async Task TestButtonHandler() { ErrorInfo t = new ErrorInfo { ErrorArea = "Test Alert", ErrorMessage = "Test Alert with detail and even more detail and more and more and more", }; t.Add("Test Line 1", "Test Value 1"); t.Add("Test LIne 2", "Test Value 2"); App.Current.Services.GetService <IErrorNotifications>().NotifyAlert("Test Alert", t); t = new ErrorInfo { ErrorArea = "Test Error", ErrorMessage = "Test Error with detail and even more detail and more and more and more", }; t.Add("Test Line 1", "Test Value 1"); t.Add("Test LIne 2", "Test Value 2"); App.Current.Services.GetService <IErrorNotifications>().NotifyError(t); t = new ErrorInfo { ErrorArea = "Test Exception", ErrorMessage = "Test Exception with detail and even more detail and more and more and more", }; t.Add("Test Line 1", "Test Value 1"); t.Add("Test LIne 2", "Test Value 2"); App.Current.Services.GetService <IErrorNotifications>().NotifyException("Test Exception", new System.Exception(), t); }
public void ShouldBeAbleToAddMoreThanOneError() { ErrorInfo info = new ErrorInfo("Name"); info.Add("Can't be blank"); info.Add("Can't be less than 10"); Assert.AreEqual("Name can't be blank and can't be less than 10", info.ToString()); }
public void ToStringShouldCombineFieldNameAndErrorText() { ErrorInfo info = new ErrorInfo("Name"); info.Add("Can't be blank"); Assert.AreEqual("Name can't be blank", info.ToString()); }
public void Upload() { try { this.SaveFile(); this.BeforeUploadToFtp(); if (ErrorInfo.Count == 0) { this.UploadToFtp(); ErrorCode = 0; this.AfterUploadToFtp(); if (ErrorInfo.Count > 0) { ErrorCode = -200; } } else { ErrorCode = -200; } } catch (Exception ex) { ErrorCode = 500; ErrorInfo.Add(ex.Message); throw; } }
private void ProcessOptionalCommandLineEntry(string commandLineEntry) { if (commandLineEntry.StartsWithCommandLineArg("endpoint")) { var arg = commandLineEntry.Split('='); if (arg.Length == 2) { Endpoint = arg[1]; } } if (commandLineEntry.StartsWithCommandLineArg("dbselectcount")) { var arg = commandLineEntry.Split('='); var dbReadCount = -1; if ((arg.Length == 2) && int.TryParse(arg[1], out dbReadCount) && DbReadCount > 0) { DbReadCount = dbReadCount; } else { ErrorInfo.Add("Invalid DBSELECTCOUNT parameter"); } } }
public void ShouldBeAbleToCreateErrorInfoWithNameAndErrorText() { ErrorInfo info = new ErrorInfo("Name"); info.Add("Can't be blank"); Assert.AreEqual("Name", info.FieldName); Assert.AreEqual("Can't be blank", info.Errors[0]); }
private void DaImage_Error(object sender, FFImageLoading.Forms.CachedImageEvents.ErrorEventArgs e) { ErrorInfo extraInfo = new ErrorInfo(); if (CurrentHLinkMediaModel.Valid) { extraInfo.Add("HLinkMediaModel HLinkKey", CurrentHLinkMediaModel.HLinkKey.Value); extraInfo.Add("MediaModel Id", CurrentHLinkMediaModel.DeRef.Id); } App.Current.Services.GetService <IErrorNotifications>().NotifyException(argMessage: "Error exception in MediaImageFull. Error is ", argException: e.Exception, argExtraItems: extraInfo); if (!(sender is null)) { (sender as FFImageLoading.Forms.CachedImage).Cancel(); (sender as FFImageLoading.Forms.CachedImage).Source = null; } }
private void NewMediaControl_Error(object sender, CachedImageEvents.ErrorEventArgs e) { ErrorInfo t = new ErrorInfo("Error in HLinkVisualDisplay.") { { "Error is ", e.Exception.Message }, }; // Component not found exception if (e.Exception.HResult == -2003292336) { t.Add("Ideas", "Showing bad file, perhaps an internalmediafile or the file type can not be displayed?"); } t.Add("File", (sender as CachedImage).Source.ToString()); App.Current.Services.GetService <IErrorNotifications>().NotifyError(t); (sender as CachedImage).Cancel(); (sender as CachedImage).Source = null; }
/// <summary> /// 写错误信息 /// </summary> /// <param name="message">消息</param> public static void WriteErrorInfo(string message) { ErrorInfo.Add(message); }
internal void SaveError(string key, string type, string message) { ErrorInfo.Add(new ErrorInfoItem { Key = key, Type = type, Message = message }); }
public ParseCommandLineStatus LoadParameterInfo(string[] args) { var parameterStatus = ParseCommandLineStatus.ExecuteProgram; if (args.Length == 0 || args[0].IsSameCommandLineArg("?") || args[0].IsSameCommandLineArg("help")) { parameterStatus = ParseCommandLineStatus.DisplayHelp; } else { foreach (var arg in args) { if (arg.IsSameCommandLineArg("console")) { ConsoleMode = true; } ProcessOptionalCommandLineEntry(arg); } } if (Endpoint.IsNullOrEmpty()) { Endpoint = ConfigurationManager.AppSettings["Endpoint"]; if (Endpoint.IsNullOrEmpty()) { ErrorInfo.Add("Endpoint is not properly setup in the application configuration and was not passed at the command line."); } } if (LocalLogStorage.IsNullOrEmpty()) { LocalLogStorage = ConfigurationManager.ConnectionStrings["LocalLogStorage"]?.ConnectionString; if (LocalLogStorage.IsNullOrEmpty()) { ErrorInfo.Add("LocalLogStorage is not properly setup in the application configuration and was not passed at the command line."); } } if (DbReadCount < 1) { var tempDbReadCount = ConfigurationManager.AppSettings["DBSelectCount"]; if (!tempDbReadCount.IsNullOrEmpty()) { var tempDbReadCountInt = -1; if (int.TryParse(tempDbReadCount, out tempDbReadCountInt)) { DbReadCount = tempDbReadCountInt; } } } // Just default this if not found or if it was invalid in app config. if (DbReadCount < 1) { DbReadCount = 10; } if (ErrorInfo.Count > 0) { parameterStatus = ParseCommandLineStatus.DisplayError; ErrorInfo.Add("Use /? to display help information about this program."); } return(parameterStatus); }
/// <summary> /// 文件转换和检查 /// </summary> /// <param name="FolderPath">要素文件夹中路径</param> /// <returns>错误信息</returns> private void ConvertAndCheckFile(string FolderPath) { string[] files = Directory.GetFiles(FolderPath, "*.*", SearchOption.AllDirectories); // 格式转换 try { ConvertedResult = DataConvertAppService.FormatConvert(files.Select(p => new ConvertFileList { PhysicsFilePath = p }), ErrorInfo, _dataConvertAppService); } catch (Exception ex) { ErrorInfo.Add("格式转换失败: " + ex.Message); return; } // 坐标转换 try { ConvertedResult = DataConvertAppService.CoordinateConvert(ConvertedResult.fileList, ErrorInfo, _dataConvertAppService); } catch (Exception ex) { ErrorInfo.Add("坐标转换失败: " + ex.Message); return; } #region 投影转换 // 投影转换 try { ConvertedResult = DataConvertAppService.ProjectionConvert(ConvertedResult.fileList, ErrorInfo, _dataConvertAppService); } catch (Exception ex) { ErrorInfo.Add("投影转换失败: " + ex.Message); return; } #endregion //// 属性检查 //List<string> CheckFile = new List<string>(); //foreach (var f in result.fileList) //{ // if (f.ConvertResult == 0) // { // ErrorInfo.Add("坐标转换失败: " + f.ConvertMsg + " 文件:" + f.PhysicsFilePath); // return ErrorInfo; // } // CheckFile.Add(f.ConvertFilePath); //} //DataCheckResult dcResult = DataConvert.DataCheck(CheckFile, false); //foreach (var cl in dcResult.CheckInfoList) //{ // if (cl.Log.Count > 0) // { // FileInfo ff = new FileInfo(cl.FileName); // ErrorInfo.Add(ff.Name + " " + cl.Log[0]); // } //} }