当前位置: 首页>>代码示例>>C#>>正文


C# ErrorInfo类代码示例

本文整理汇总了C#中ErrorInfo的典型用法代码示例。如果您正苦于以下问题:C# ErrorInfo类的具体用法?C# ErrorInfo怎么用?C# ErrorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorInfo类属于命名空间,在下文中一共展示了ErrorInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Append

        public override void Append(ErrorInfo error)
        {
            var pairs = new List<KeyValuePair<string, string>>();
            foreach (AssemblyPart ap in Deployment.Current.Parts)
            {
                StreamResourceInfo sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative));
                if (sri != null)
                {
                    Assembly assembly = new AssemblyPart().Load(sri.Stream);

                    pairs.Add(Message("Assembly", assembly.FullName));
                    pairs.Add(Message("ImageRuntimeVersion", assembly.ImageRuntimeVersion));

                    try
                    {
                        if (assembly.Location.Length != 0)
                        {
                            pairs.Add(Message("Location", assembly.Location));
                        }
                    }
                    catch
                    {
                    }
                }
            }
            error.AddDetail(this.Name, pairs);
        }
开发者ID:janbernloehr,项目名称:vinco-logging-toolkit,代码行数:27,代码来源:AssemblyAppender.cs

示例2: Append

        public override void Append(ErrorInfo errorInfo)
        {
            var sb = new StringBuilder();
            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            foreach (Assembly assembly in assemblies)
            {
                sb.AppendLine(assembly.GetName().FullName);
            }
            sb.AppendLine();

            // Get file info
            foreach (Assembly assembly in assemblies)
            {
                bool flag = false;
                try
                {
                    if (assembly.Location.Length != 0)
                    {
                        sb.Append(FileVersionInfo.GetVersionInfo(assembly.Location).ToString());
                        flag = true;
                    }
                }
                catch(Exception)
                {
                }
                if (!flag)
                {
                    sb.Append(assembly.ToString());
                }
                sb.AppendLine();
            }
            errorInfo.AddDetail(this.Name, "", sb.ToString());
        }
开发者ID:janbernloehr,项目名称:vinco-logging-toolkit,代码行数:33,代码来源:AssemblyAppender.cs

示例3: GetPropertyError

        public void GetPropertyError(string propertyName, ErrorInfo info)
        {
            if (propertyName == "CustomerType" && string.IsNullOrEmpty(CustomerType))
            {
                info.ErrorText = "Please enter customer type";
            }
            if (propertyName == "CustomerName" && string.IsNullOrEmpty(CustomerName))
            {
                info.ErrorText = "Please enter customer name ";
            }
            if(propertyName=="MemberNo" && !string.IsNullOrEmpty(CustomerType))
            {
                if (CustomerType == "0")
                {
                     if(string.IsNullOrEmpty(MemberNo))
                    {
                        info.ErrorText = "Please enter member no ";  
                    }
                }
            }
            if (propertyName == "CustomerId" && string.IsNullOrEmpty(CustomerId))
            {
                info.ErrorText = "Please enter mobile no ";
            }
            else if (propertyName == "CustomerId" && !string.IsNullOrEmpty(CustomerId))
            {
               if (new BlCustomer().CheckCustomerId(CustomerId, CustomerNo))
               {
                   info.ErrorText = "Duplicate mobile no ";
               }
            }
            


        }
开发者ID:rehman922,项目名称:VIRETAIL,代码行数:35,代码来源:BLCustomer.cs

示例4: Append

        public override void Append(ErrorInfo errorInfo)
        {
            Assembly assembly = errorInfo.GetType().Assembly;

            var pairs = new Dictionary<string, string>();
            pairs.Add("Date", DateTime.Now.ToString());
            pairs.Add("Culture", CultureInfo.CurrentCulture.Name);

            #if !SILVERLIGHT

            pairs.Add("User", string.Format(CultureInfo.InvariantCulture, @"{0}\{1}", Environment.UserDomainName, Environment.UserName).Trim('\\'));
            pairs.Add("Machine Name", Environment.MachineName);
            pairs.Add("App Start Time", Process.GetCurrentProcess().StartTime.ToLocalTime().ToString(CultureInfo.InvariantCulture));
            pairs.Add("App Up Time", (DateTime.Now - Process.GetCurrentProcess().StartTime.ToLocalTime()).ToString());
            pairs.Add("Worker process", GetWorkerProcess());
            pairs.Add("AppDomain", AppDomainDetail(AppDomain.CurrentDomain));
            pairs.Add("Deployment", (assembly.GlobalAssemblyCache) ? "GAC" : "bin");

            #endif
            pairs.Add("Thread Id", Thread.CurrentThread.ManagedThreadId.ToString(CultureInfo.InvariantCulture));
            pairs.Add("Full Name", new AssemblyName(assembly.FullName).FullName);
            pairs.Add("Operating System Version", Environment.OSVersion.ToString());
            pairs.Add("Common Language Runtime Version", Environment.Version.ToString());
            pairs.Add("Elmah.Everywhere Version", new AssemblyName(typeof(Diagnostics.ExceptionHandler).Assembly.FullName).Version.ToString());

            errorInfo.AddDetail(this.Name, pairs);
        }
开发者ID:onurak,项目名称:vinco-logging-toolkit,代码行数:27,代码来源:DetailAppender.cs

示例5: IsWarnningAdded

 /// <summary>
 /// 
 /// </summary>
 /// <param name="plcVarName"></param>
 /// <returns>ture added, false removed</returns>
 public Boolean IsWarnningAdded( ErrorInfo info)
 {
     Boolean result = false;
     if(info != null){
         result = mSortedWarnningMap.ContainsKey(info.level);
     }
     return  result;
 }
开发者ID:junzheng,项目名称:YF17A,代码行数:13,代码来源:WarnningDataSource.cs

示例6: Appenders_Is_Null_Test

        public void Appenders_Is_Null_Test()
        {
            // Act
            ErrorInfo error = new ErrorInfo();

            // Assert
            Assert.Null(error.Appenders);
        }
开发者ID:janbernloehr,项目名称:vinco-logging-toolkit,代码行数:8,代码来源:ErrorInfoTest.cs

示例7: Append

 public override void Append(ErrorInfo errorInfo)
 {
     var memorystatusex = new MemoryStatusEx();
     if (NativeMethods.GlobalMemoryStatusEx(memorystatusex))
     {
         errorInfo.AddDetail(this.Name, "Total Memory", string.Format(CultureInfo.InvariantCulture, "{0} MB", memorystatusex.ullTotalPhys / (1024 * 1024)));
         errorInfo.AddDetail(this.Name, "Available Memory", string.Format(CultureInfo.InvariantCulture, "{0} MB", memorystatusex.ullAvailPhys / (1024 * 1024)));
     }
 }
开发者ID:janbernloehr,项目名称:vinco-logging-toolkit,代码行数:9,代码来源:MemoryAppender.cs

示例8: SetErrorInfo

 void IDXDataErrorInfo.GetError(ErrorInfo info)
 {
     if (StartDate > EndDate)
     {
         SetErrorInfo(info,
             "Either StartDate or EndDate should be corrected.",
             ErrorType.Critical);
     }
 }
开发者ID:powernick,项目名称:CodeLib,代码行数:9,代码来源:DataSource.cs

示例9: IsError

 /************************************************************************/
 /************************************************************************/
 public static int IsError(ErrorInfo e)
 {
     if (e.Value != 0)
     {
         MessageBox.Show(e.Message);
         return 1;
     }
     return 0;
 }
开发者ID:rlmaso2,项目名称:NI_Theromocouple_Read_Set_Temp,代码行数:11,代码来源:Form1.cs

示例10: AddError

        /// <summary>
        /// Add an error to the ErrorCollection.
        /// </summary>
        /// <param name="lineNumber">The line when the error occurs.</param>
        /// <param name="ex">The exception thrown, can be null.</param>
        /// <param name="recordLine">The record values</param>
        protected void AddError(int lineNumber, Exception ex, string recordLine)
        {
            ErrorInfo e = new ErrorInfo();
            e.mLineNumber = lineNumber;
//			e.mColumnNumber = colNum;
            e.mExceptionInfo = ex;
            e.mRecordString = recordLine;

            mErrorManager.AddError(e);
        }
开发者ID:calebillman,项目名称:FileHelpers,代码行数:16,代码来源:DataStorage.cs

示例11: GetPropertyError

 public void GetPropertyError(string propertyName, ErrorInfo info)
 {
     if (propertyName == "Username" && string.IsNullOrEmpty(Username)
         || propertyName == "Fullname" && string.IsNullOrWhiteSpace(Fullname)
         || propertyName == "Empno" && string.IsNullOrEmpty(Empno)
         || propertyName == "Password" && string.IsNullOrEmpty(Password)
         || propertyName == "Role" && string.IsNullOrEmpty(Role)
         || propertyName == "Password1" && string.IsNullOrEmpty(Password1)
         || propertyName == "Profileid" && string.IsNullOrEmpty(Profileid))
         info.ErrorText = String.Format("The '{0}' field cannot be empty", propertyName);
 }
开发者ID:rehman922,项目名称:VIRETAIL,代码行数:11,代码来源:BLUserinfo.cs

示例12: Append

        public override void Append(ErrorInfo errorInfo)
        {
            var pairs = new Dictionary<string, string>();
            pairs.Add("CellularMobileOperator", DeviceNetworkInformation.CellularMobileOperator);
            pairs.Add("IsCellularDataEnabled", DeviceNetworkInformation.IsCellularDataEnabled.ToString());
            pairs.Add("IsCellularDataRoamingEnabled", DeviceNetworkInformation.IsCellularDataRoamingEnabled.ToString());
            pairs.Add("IsNetworkAvailable", DeviceNetworkInformation.IsNetworkAvailable.ToString());
            pairs.Add("IsWiFiEnabled", DeviceNetworkInformation.IsWiFiEnabled.ToString());

            errorInfo.AddDetail(this.Name, pairs);
        }
开发者ID:janbernloehr,项目名称:vinco-logging-toolkit,代码行数:11,代码来源:DeviceNetworkAppender.cs

示例13: BuildMessage_Returns_Error_Detail_Message_If_ErrorDetails_Are_Empty_Test

        public void BuildMessage_Returns_Error_Detail_Message_If_ErrorDetails_Are_Empty_Test()
        {
            // Arrange
            ErrorInfo error = new ErrorInfo(new Exception());

            // Act
            string detail = error.BuildMessage();

            // Assert
            Assert.Equal(error.Detail, detail);
        }
开发者ID:janbernloehr,项目名称:vinco-logging-toolkit,代码行数:11,代码来源:ErrorInfoTest.cs

示例14: TryGetStatFsForDriveName

        /// <summary>
        /// Attempts to get a statfs struct for a given mount point.
        /// </summary>
        /// <param name="name">The drive name to retrieve the statfs data for.</param>
        /// <param name="data">The data retrieved from the mount point.</param>
        /// <returns>Returns true if data was filled with the results; otherwise, false.</returns>
        internal static bool TryGetStatFsForDriveName(string name, out statfs data, out ErrorInfo errorInfo)
        {
            data = default(statfs);
            if (get_statfs(name, out data) < 0)
            {
                errorInfo = Interop.Sys.GetLastErrorInfo();
                return false;
            }

            errorInfo = default(ErrorInfo);
            return true;
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:18,代码来源:Interop.mountpoints.cs

示例15: AddWarningItem

        public void AddWarningItem(ErrorInfo info)
        {
            int key = info.level;
            mSortedWarnningMap.Add(key, info);

            //reorder warning
            mWarnningList.Clear();
            mWarnningList = mSortedWarnningMap.Values.ToList();
            mWarnningList.Add(ERROEINFO_NORMAL);

            Warnning.write(info);
        }
开发者ID:junzheng,项目名称:YF17A,代码行数:12,代码来源:WarnningDataSource.cs


注:本文中的ErrorInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。