示例#1
0
 /// <summary>
 /// 设置样式,不存在添加,存在则用新样式替换旧样式
 /// </summary>
 /// <param name="style">样式</param>
 public void SetStyle(LogShowStyle style)
 {
     lock (this._logLock)
     {
         var id = style.ID;
         if (this._styleDic.ContainsKey(id))
         {
             this._styleDic[id] = style;
         }
         else
         {
             this._styleDic.Add(id, style);
         }
     }
 }
示例#2
0
        /// <summary>
        /// 移除样式
        /// </summary>
        /// <param name="style">样式标识</param>
        public void RemoveStyle(LogShowStyle style)
        {
            if (style == null)
            {
                return;
            }

            lock (this._logLock)
            {
                var id = style.ID;
                if (this._styleDic.ContainsKey(id))
                {
                    this._styleDic.Remove(id);
                }
            }
        }
示例#3
0
        /// <summary>
        /// 构造函数
        /// </summary>
        public LogControl()
            : base()
        {
            this.HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled;
            this.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;

            this.IsReadOnly      = true;
            this.Background      = Brushes.Black;
            this.BorderThickness = new Thickness(0d);
            this._paragraph      = new Paragraph();
            base.Document.Blocks.Clear();
            base.Document.Blocks.Add(this._paragraph);

            this._primitiveShowLogDelegate = new Action <List <ShowLogItem> >(this.PrimitiveShowLog);
            this._priority = this.Priority;

            this._defaultStyle = new LogShowStyle(0, Colors.Gray)
            {
                Name = "默认样式"
            };
            this.AddDefaultStyle();
            this.StartRefreshLogThread();
        }
示例#4
0
 /// <summary>
 /// 移除样式
 /// </summary>
 /// <param name="style">样式标识</param>
 public void RemoveStyle(LogShowStyle style)
 {
     logControl.RemoveStyle(style);
 }
示例#5
0
 /// <summary>
 /// 设置样式,不存在添加,存在则用新样式替换旧样式
 /// </summary>
 /// <param name="style">样式</param>
 public void SetStyle(LogShowStyle style)
 {
     logControl.SetStyle(style);
 }