Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王永辉
VIZ.Framework
Commits
5b9bd409
Commit
5b9bd409
authored
Jul 22, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 修复数字输入框限制精度的bug
2. 固定buffer处理器添加同步针头校验 3. 模型添加安全更新方式
parent
717b5284
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
5 deletions
+111
-5
VIZ.Framework.Common/Widgets/NumberBox/NumberBox.cs
+3
-3
VIZ.Framework.Connection/Core/ConnMessageBase.cs
+5
-0
VIZ.Framework.Connection/Provider/FixedBuffer/ConnFixedBufferPackageProvider.cs
+63
-1
VIZ.Framework.Core/Core/WPF/ModelBase.cs
+39
-0
VIZ.Framework.ImageContrastTool/ViewModel/MainViewModel.cs
+1
-1
No files found.
VIZ.Framework.Common/Widgets/NumberBox/NumberBox.cs
View file @
5b9bd409
...
...
@@ -193,7 +193,7 @@ namespace VIZ.Framework.Common
}
value
=
MathHelper
.
Clip
(
this
.
MinValue
,
this
.
MaxValue
,
value
);
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
value
));
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
));
this
.
Text
=
value
.
ToString
();
this
.
Value
=
value
;
...
...
@@ -227,7 +227,7 @@ namespace VIZ.Framework.Common
private
void
PART_Down_Click
(
object
sender
,
RoutedEventArgs
e
)
{
double
value
=
this
.
Value
-
this
.
Interval
;
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
value
));
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
));
if
(
value
<
this
.
MinValue
||
value
>
this
.
MaxValue
)
return
;
...
...
@@ -241,7 +241,7 @@ namespace VIZ.Framework.Common
private
void
PART_Up_Click
(
object
sender
,
RoutedEventArgs
e
)
{
double
value
=
this
.
Value
+
this
.
Interval
;
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
value
));
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
));
if
(
value
<
this
.
MinValue
||
value
>
this
.
MaxValue
)
return
;
...
...
VIZ.Framework.Connection/Core/ConnMessageBase.cs
View file @
5b9bd409
...
...
@@ -40,5 +40,10 @@ namespace VIZ.Framework.Connection
/// 处理器
/// </summary>
public
IConnPackageProvider
Provider
{
get
;
internal
set
;
}
/// <summary>
/// 消息创建时间
/// </summary>
public
DateTime
DateTime
{
get
;
internal
set
;
}
=
DateTime
.
Now
;
}
}
VIZ.Framework.Connection/Provider/FixedBuffer/ConnFixedBufferPackageProvider.cs
View file @
5b9bd409
...
...
@@ -23,11 +23,17 @@ namespace VIZ.Framework.Connection
/// 固定长度Buffer包解析器
/// </summary>
/// <param name="fixedBufferSize">固定Buffer长度</param>
public
ConnFixedBufferPackageProvider
(
int
fixedBufferSize
)
/// <param name="syncHeader">同步头</param>
public
ConnFixedBufferPackageProvider
(
int
fixedBufferSize
,
IEnumerable
<
byte
>
syncHeader
)
{
this
.
FixedBufferSize
=
fixedBufferSize
;
this
.
buffer_index
=
0
;
this
.
buffer_cache
=
new
byte
[
fixedBufferSize
];
if
(
syncHeader
!=
null
)
{
this
.
SyncHeader
.
AddRange
(
SyncHeader
);
}
}
/// <summary>
...
...
@@ -36,6 +42,11 @@ namespace VIZ.Framework.Connection
public
int
FixedBufferSize
{
get
;
private
set
;
}
/// <summary>
/// 同步头
/// </summary>
public
List
<
byte
>
SyncHeader
{
get
;
private
set
;
}
=
new
List
<
byte
>();
/// <summary>
/// 数据缓存
/// </summary>
private
byte
[]
buffer_cache
;
...
...
@@ -63,6 +74,21 @@ namespace VIZ.Framework.Connection
if
(
this
.
buffer_index
<
this
.
FixedBufferSize
)
continue
;
// 同步头
int
sync_index
=
this
.
getSyncIndex
();
if
(
sync_index
<
0
)
{
continue
;
}
if
(
sync_index
>
0
)
{
byte
[]
buffer_cache_new
=
new
byte
[
this
.
FixedBufferSize
];
Array
.
Copy
(
this
.
buffer_cache
,
sync_index
,
buffer_cache_new
,
0
,
this
.
FixedBufferSize
-
sync_index
);
this
.
buffer_index
-=
sync_index
;
continue
;
}
// 处理器处理消息
ConnFixedBufferInfo
info
=
new
ConnFixedBufferInfo
();
info
.
LocalIP
=
package
.
LocalIP
;
...
...
@@ -113,5 +139,40 @@ namespace VIZ.Framework.Connection
{
// noting to do.
}
/// <summary>
/// 获取当前同步帧位序
/// </summary>
/// <returns>获取当前同步帧位序</returns>
private
int
getSyncIndex
()
{
if
(
this
.
SyncHeader
.
Count
==
0
)
return
0
;
for
(
int
i
=
0
;
i
<
this
.
FixedBufferSize
-
this
.
SyncHeader
.
Count
;
++
i
)
{
if
(
this
.
isSameSyncBuffer
(
i
))
return
i
;
}
// 未找到同步数据
return
-
1
;
}
/// <summary>
/// 是否是相同的同步帧buffer
/// </summary>
/// <param name="index">开始位序</param>
/// <returns>是否是相同的同步帧buffer</returns>
private
bool
isSameSyncBuffer
(
int
index
)
{
for
(
int
i
=
0
;
i
<
this
.
SyncHeader
.
Count
;
++
i
)
{
if
(
this
.
buffer_cache
[
index
+
i
]
!=
this
.
SyncHeader
[
i
])
return
false
;
}
return
true
;
}
}
}
\ No newline at end of file
VIZ.Framework.Core/Core/WPF/ModelBase.cs
View file @
5b9bd409
...
...
@@ -4,6 +4,7 @@ using System.ComponentModel;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
namespace
VIZ.Framework.Core
{
...
...
@@ -32,6 +33,25 @@ namespace VIZ.Framework.Core
}
/// <summary>
/// 触发属性改变前事件(安全方式)
/// </summary>
/// <param name="propertyName">属性名</param>
public
void
RaisePropertySaveChanging
(
string
propertyName
)
{
if
(
Application
.
Current
.
Dispatcher
.
CheckAccess
())
{
this
.
PropertyChanging
?.
Invoke
(
this
,
new
PropertyChangingEventArgs
(
propertyName
));
return
;
}
WPFHelper
.
BeginInvoke
(()
=>
{
this
.
PropertyChanging
?.
Invoke
(
this
,
new
PropertyChangingEventArgs
(
propertyName
));
});
}
/// <summary>
/// 触发属性改变后事件
/// </summary>
/// <param name="propertyName">属性名</param>
...
...
@@ -39,5 +59,24 @@ namespace VIZ.Framework.Core
{
this
.
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
}
/// <summary>
/// 触发属性改变后事件(安全方式)
/// </summary>
/// <param name="propertyName">属性名</param>
public
void
RaisePropertySaveChanged
(
string
propertyName
)
{
if
(
Application
.
Current
.
Dispatcher
.
CheckAccess
())
{
this
.
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
return
;
}
WPFHelper
.
BeginInvoke
(()
=>
{
this
.
PropertyChanged
?.
Invoke
(
this
,
new
PropertyChangedEventArgs
(
propertyName
));
});
}
}
}
VIZ.Framework.ImageContrastTool/ViewModel/MainViewModel.cs
View file @
5b9bd409
...
...
@@ -209,7 +209,7 @@ namespace VIZ.Framework.ImageContrastTool
{
if
(
System
.
IO
.
Directory
.
Exists
(
this
.
LeftPath
))
{
this
.
ImageFiles
=
System
.
IO
.
Directory
.
GetFiles
(
this
.
LeftPath
,
"*.
jpg
"
).
ToList
();
this
.
ImageFiles
=
System
.
IO
.
Directory
.
GetFiles
(
this
.
LeftPath
,
"*.
*
"
).
ToList
();
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment