Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
孙克
/
ACSingleStore
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit 6a47659d
由
LN
编写于
2020-01-04 19:02:13 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
日志修改
1 个父辈
4e115a0a
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
67 行增加
和
50 行删除
source/ACSingleStore/FrmStoreBox.Designer.cs
source/ACSingleStore/FrmStoreBox.cs
source/Common/util/LogUtil.cs
source/ACSingleStore/FrmStoreBox.Designer.cs
查看文件 @
6a47659
...
@@ -701,12 +701,13 @@
...
@@ -701,12 +701,13 @@
this
.
richTextBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
this
.
richTextBox1
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
richTextBox1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
7.5
F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
richTextBox1
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9
F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
richTextBox1
.
Location
=
new
System
.
Drawing
.
Point
(
7
,
92
);
this
.
richTextBox1
.
Location
=
new
System
.
Drawing
.
Point
(
7
,
92
);
this
.
richTextBox1
.
Name
=
"richTextBox1"
;
this
.
richTextBox1
.
Name
=
"richTextBox1"
;
this
.
richTextBox1
.
Size
=
new
System
.
Drawing
.
Size
(
545
,
4
25
);
this
.
richTextBox1
.
Size
=
new
System
.
Drawing
.
Size
(
545
,
4
54
);
this
.
richTextBox1
.
TabIndex
=
256
;
this
.
richTextBox1
.
TabIndex
=
256
;
this
.
richTextBox1
.
Text
=
""
;
this
.
richTextBox1
.
Text
=
""
;
this
.
richTextBox1
.
VisibleChanged
+=
new
System
.
EventHandler
(
this
.
richTextBox1_VisibleChanged
);
//
//
// groupBox1
// groupBox1
//
//
...
@@ -1670,7 +1671,7 @@
...
@@ -1670,7 +1671,7 @@
this
.
btnClearLog
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
btnClearLog
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
btnClearLog
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnClearLog
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnClearLog
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnClearLog
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnClearLog
.
Location
=
new
System
.
Drawing
.
Point
(
310
,
5
32
);
this
.
btnClearLog
.
Location
=
new
System
.
Drawing
.
Point
(
310
,
5
63
);
this
.
btnClearLog
.
Name
=
"btnClearLog"
;
this
.
btnClearLog
.
Name
=
"btnClearLog"
;
this
.
btnClearLog
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
38
);
this
.
btnClearLog
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
38
);
this
.
btnClearLog
.
TabIndex
=
224
;
this
.
btnClearLog
.
TabIndex
=
224
;
...
@@ -1853,7 +1854,7 @@
...
@@ -1853,7 +1854,7 @@
this
.
btnCloseDoor
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
btnCloseDoor
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
btnCloseDoor
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnCloseDoor
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnCloseDoor
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnCloseDoor
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnCloseDoor
.
Location
=
new
System
.
Drawing
.
Point
(
146
,
5
32
);
this
.
btnCloseDoor
.
Location
=
new
System
.
Drawing
.
Point
(
146
,
5
63
);
this
.
btnCloseDoor
.
Name
=
"btnCloseDoor"
;
this
.
btnCloseDoor
.
Name
=
"btnCloseDoor"
;
this
.
btnCloseDoor
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
38
);
this
.
btnCloseDoor
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
38
);
this
.
btnCloseDoor
.
TabIndex
=
258
;
this
.
btnCloseDoor
.
TabIndex
=
258
;
...
@@ -1866,7 +1867,7 @@
...
@@ -1866,7 +1867,7 @@
this
.
btnOpenDoor
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
btnOpenDoor
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Bottom
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Left
)));
this
.
btnOpenDoor
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnOpenDoor
.
FlatStyle
=
System
.
Windows
.
Forms
.
FlatStyle
.
Flat
;
this
.
btnOpenDoor
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnOpenDoor
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
btnOpenDoor
.
Location
=
new
System
.
Drawing
.
Point
(
29
,
5
32
);
this
.
btnOpenDoor
.
Location
=
new
System
.
Drawing
.
Point
(
29
,
5
63
);
this
.
btnOpenDoor
.
Name
=
"btnOpenDoor"
;
this
.
btnOpenDoor
.
Name
=
"btnOpenDoor"
;
this
.
btnOpenDoor
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
38
);
this
.
btnOpenDoor
.
Size
=
new
System
.
Drawing
.
Size
(
105
,
38
);
this
.
btnOpenDoor
.
TabIndex
=
257
;
this
.
btnOpenDoor
.
TabIndex
=
257
;
...
...
source/ACSingleStore/FrmStoreBox.cs
查看文件 @
6a47659
...
@@ -1386,6 +1386,9 @@ namespace OnlineStore.ACSingleStore
...
@@ -1386,6 +1386,9 @@ namespace OnlineStore.ACSingleStore
LogUtil
.
logBox
=
this
.
richTextBox1
;
LogUtil
.
logBox
=
this
.
richTextBox1
;
}
}
private
void
richTextBox1_VisibleChanged
(
object
sender
,
EventArgs
e
)
{
LogUtil
.
UpdateLogbox
();
}
}
}
}
}
source/Common/util/LogUtil.cs
查看文件 @
6a47659
...
@@ -20,7 +20,7 @@ namespace OnlineStore.Common
...
@@ -20,7 +20,7 @@ namespace OnlineStore.Common
public
static
System
.
Windows
.
Forms
.
RichTextBox
logBox
=
null
;
public
static
System
.
Windows
.
Forms
.
RichTextBox
logBox
=
null
;
public
static
int
showCount
=
30
;
public
static
int
showCount
=
15
;
public
static
bool
debug_opened
=
false
;
public
static
bool
debug_opened
=
false
;
...
@@ -33,20 +33,14 @@ namespace OnlineStore.Common
...
@@ -33,20 +33,14 @@ namespace OnlineStore.Common
}
}
log
.
Info
(
log
.
Logger
.
Name
+
" - "
+
msg
);
log
.
Info
(
log
.
Logger
.
Name
+
" - "
+
msg
);
if
(
logBox
==
null
)
{
return
;
}
AddToBox
(
msg
,
Color
.
Black
);
AddToBox
(
msg
,
Color
.
Black
);
//clear();
//clear();
}
}
public
static
void
info
(
ILog
log
,
string
msg
,
Color
color
)
public
static
void
info
(
ILog
log
,
string
msg
,
Color
color
)
{
{
log
.
Info
(
log
.
Logger
.
Name
+
" - "
+
msg
);
log
.
Info
(
log
.
Logger
.
Name
+
" - "
+
msg
);
if
(
logBox
==
null
)
{
return
;
}
AddToBox
(
msg
,
color
);
AddToBox
(
msg
,
color
);
}
}
public
static
void
debug
(
ILog
log
,
string
msg
,
Color
color
)
public
static
void
debug
(
ILog
log
,
string
msg
,
Color
color
)
...
@@ -54,10 +48,6 @@ namespace OnlineStore.Common
...
@@ -54,10 +48,6 @@ namespace OnlineStore.Common
log
.
Debug
(
log
.
Logger
.
Name
+
" - "
+
msg
);
log
.
Debug
(
log
.
Logger
.
Name
+
" - "
+
msg
);
if
(
debug_opened
)
if
(
debug_opened
)
{
{
if
(
logBox
==
null
)
{
return
;
}
AddToBox
(
msg
,
color
);
AddToBox
(
msg
,
color
);
}
}
}
}
...
@@ -66,10 +56,6 @@ namespace OnlineStore.Common
...
@@ -66,10 +56,6 @@ namespace OnlineStore.Common
log
.
Debug
(
log
.
Logger
.
Name
+
" - "
+
msg
);
log
.
Debug
(
log
.
Logger
.
Name
+
" - "
+
msg
);
if
(
debug_opened
)
if
(
debug_opened
)
{
{
if
(
logBox
==
null
)
{
return
;
}
AddToBox
(
msg
,
Color
.
Gray
);
AddToBox
(
msg
,
Color
.
Gray
);
}
}
}
}
...
@@ -107,21 +93,9 @@ namespace OnlineStore.Common
...
@@ -107,21 +93,9 @@ namespace OnlineStore.Common
}
}
public
static
void
error
(
ILog
log
,
string
errorMsg
)
public
static
void
error
(
ILog
log
,
string
errorMsg
)
{
{
//if (!lasErrorLogList.Contains(errorMsg))
{
log
.
Error
(
log
.
Logger
.
Name
+
" - "
+
errorMsg
);
log
.
Error
(
log
.
Logger
.
Name
+
" - "
+
errorMsg
);
if
(
logBox
==
null
)
{
return
;
}
AddToBox
(
errorMsg
,
Color
.
Red
);
AddToBox
(
errorMsg
,
Color
.
Red
);
}
}
//lasErrorLogList.Add(errorMsg);
//if (lasErrorLogList.Count > errCount)
//{
// lasErrorLogList.RemoveAt(0);
//}
}
private
static
void
AddToBox
(
string
msg
,
Color
color
)
private
static
void
AddToBox
(
string
msg
,
Color
color
)
{
{
try
try
...
@@ -133,45 +107,84 @@ namespace OnlineStore.Common
...
@@ -133,45 +107,84 @@ namespace OnlineStore.Common
LOGGER
.
Error
(
"出错:"
+
ex
.
StackTrace
);
LOGGER
.
Error
(
"出错:"
+
ex
.
StackTrace
);
}
}
}
}
private
static
int
count
=
0
;
private
static
List
<
string
>
logList
=
new
List
<
string
>();
public
static
string
LastText
=
""
;
private
static
void
ShowLogPro
(
string
msg
,
Color
color
)
private
static
void
ShowLogPro
(
string
msg
,
Color
color
)
{
{
try
try
{
{
//clear();
if
(
logList
.
Count
>
0
)
if
(
count
>
showCount
)
{
// logList.RemoveAt(0);
}
if
(
logList
.
Count
>=
showCount
)
{
logList
.
RemoveAt
(
0
);
}
string
text
=
""
;
foreach
(
string
str
in
logList
)
{
{
count
=
0
;
text
+=
str
;
logBox
.
Clear
();
}
}
//logBox.SelectionColor = color;
System
.
DateTime
now
=
System
.
DateTime
.
Now
;
System
.
DateTime
now
=
System
.
DateTime
.
Now
;
logBox
.
AppendText
(
now
.
ToLongTimeString
()
+
" "
+
msg
+
Environment
.
NewLine
);
logList
.
Add
(
now
.
ToLongTimeString
()
+
" "
+
msg
+
Environment
.
NewLine
);
count
++;
if
(
logBox
==
null
)
{
return
;
}
LastText
=
text
;
if
(
logBox
.
Visible
)
{
logBox
.
Text
=
text
;
// logBox.Focus(); //使文本框获取焦点
logBox
.
AppendText
(
now
.
ToLongTimeString
()
+
" "
+
msg
+
Environment
.
NewLine
);
//增加文本
TimeSpan
span
=
DateTime
.
Now
-
lastTime
;
if
(
span
.
TotalSeconds
>
10
)
{
lastTime
=
DateTime
.
Now
;
logBox
.
Select
(
logBox
.
Text
.
Length
,
0
);
//设置光标的位置到文本尾
logBox
.
ScrollToCaret
();
//滚动到控件光标处
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
LOGGER
.
Error
(
"出错:"
+
ex
.
ToString
());
LOGGER
.
Error
(
"出错:"
+
ex
.
ToString
());
}
}
}
}
public
static
void
debug
(
string
msg
)
private
static
DateTime
lastTime
=
DateTime
.
Now
;
public
static
void
UpdateLogbox
()
{
{
debug
(
LOGGER
,
msg
);
if
(
logBox
!=
null
&&
logBox
.
Visible
)
}
public
static
void
error
(
string
errorMsg
)
{
{
error
(
LOGGER
,
errorMsg
);
logBox
.
Text
=
LastText
;
}
logBox
.
Select
(
logBox
.
Text
.
Length
,
0
);
//设置光标的位置到文本尾
logBox
.
ScrollToCaret
();
//滚动到控件光标处
}
}
public
static
void
ClearLog
()
public
static
void
ClearLog
()
{
{
if
(
logBox
!=
null
)
if
(
logBox
!=
null
)
{
{
LastText
=
""
;
logList
.
Clear
();
logBox
.
Text
=
""
;
logBox
.
Text
=
""
;
count
=
0
;
}
}
}
}
public
static
void
debug
(
string
msg
)
{
debug
(
LOGGER
,
msg
);
}
public
static
void
error
(
string
errorMsg
)
{
error
(
LOGGER
,
errorMsg
);
}
public
static
void
info
(
string
msg
)
public
static
void
info
(
string
msg
)
{
{
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论