/// <summary> /// 添加一个导航。 /// </summary> /// <param name="caption">标题。</param> /// <param name="position">导航位置。</param> /// <param name="itemBuilder">导航项建造者。</param> /// <param name="classes">样式名称。</param> /// <returns>导航建造者。</returns> public NavigationBuilder Add(LocalizedString caption, string position, Action<NavigationItemBuilder> itemBuilder, IEnumerable<string> classes = null) { var childBuilder = new NavigationItemBuilder(); childBuilder.Caption(caption); childBuilder.Position(position); itemBuilder(childBuilder); Contained.AddRange(childBuilder.Build()); if (classes == null) return this; foreach (var className in classes) childBuilder.AddClass(className); return this; }
/// <summary> /// 添加一个导航。 /// </summary> /// <param name="caption">标题。</param> /// <param name="classes">样式名称。</param> /// <returns>导航建造者。</returns> public NavigationBuilder Add(LocalizedString caption, IEnumerable<string> classes = null) { return Add(caption, x => { }, classes); }
/// <summary> /// 实例化一个新的Rabbit安全异常。 /// </summary> /// <param name="message">错误消息。</param> /// <param name="innerException">内部异常。</param> public RabbitSecurityException(LocalizedString message, Exception innerException) : base(message, innerException) { }
/// <summary> /// 添加一个导航。 /// </summary> /// <param name="caption">标题。</param> /// <param name="itemBuilder">导航项建造者。</param> /// <param name="classes">样式名称。</param> /// <returns>导航建造者。</returns> public NavigationBuilder Add(LocalizedString caption, Action<NavigationItemBuilder> itemBuilder, IEnumerable<string> classes = null) { return Add(caption, null, itemBuilder, classes); }
/// <summary> /// 设置导航标题。 /// </summary> /// <param name="caption">导航标题。</param> /// <returns>导航项建造者。</returns> public NavigationItemBuilder Caption(LocalizedString caption) { _item.Text = caption; return this; }
/// <summary> /// 实例化一个新的Rabbit安全异常。 /// </summary> /// <param name="message">错误消息。</param> public RabbitSecurityException(LocalizedString message) : base(message) { }
/// <summary> /// 获取一个本地化字符串,如果不存在则返回 <paramref name="defaultValue"/>。 /// </summary> /// <param name="text">问吧。</param> /// <param name="defaultValue">默认值。</param> /// <returns>本地化字符串。</returns> public static LocalizedString TextOrDefault(string text, LocalizedString defaultValue) { return string.IsNullOrEmpty(text) ? defaultValue : new LocalizedString(text); }
/// <summary> /// 对授权许可的当前用户;如果授权失败,将显示指定的消息。 /// </summary> /// <param name="permission">针对的授权许可。</param> /// <param name="message">要显示本地化的消息,如果授权失败。</param> /// <returns>如果授权成功则返回true,否则返回false。</returns> public bool Authorize(Permission permission, LocalizedString message) { return Authorize(permission); }
/// <summary> /// 记录一个致命的错误信息。 /// </summary> /// <param name="logger">日志记录器。</param> /// <param name="exception">异常。</param> /// <param name="format">记录格式。</param> /// <param name="args">参数。</param> public static void Fatal(this ILogger logger, Exception exception, LocalizedString format, params object[] args) { FilteredLog(logger, LogLevel.Fatal, exception, format.ToString(), args); }
/// <summary> /// 记录一个错误信息。 /// </summary> /// <param name="logger">日志记录器。</param> /// <param name="format">记录格式。</param> /// <param name="args">参数。</param> public static void Error(this ILogger logger, LocalizedString format, params object[] args) { FilteredLog(logger, LogLevel.Error, null, format.ToString(), args); }
/// <summary> /// 记录一个致命的错误信息。 /// </summary> /// <param name="logger">日志记录器。</param> /// <param name="exception">异常。</param> /// <param name="message">消息。</param> public static void Fatal(this ILogger logger, Exception exception, LocalizedString message) { FilteredLog(logger, LogLevel.Fatal, exception, message.ToString(), null); }
/// <summary> /// 记录一个错误信息。 /// </summary> /// <param name="logger">日志记录器。</param> /// <param name="message">消息。</param> public static void Error(this ILogger logger, LocalizedString message) { FilteredLog(logger, LogLevel.Error, null, message.ToString(), null); }
/// <summary> /// 记录一个信息。 /// </summary> /// <param name="logger">日志记录器。</param> /// <param name="message">消息。</param> public static void Information(this ILogger logger, LocalizedString message) { FilteredLog(logger, LogLevel.Information, null, message.ToString(), null); }