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
aa923f0f
Commit
aa923f0f
authored
Oct 25, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
移除numberbox
parent
c4d5b0a0
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
74 additions
and
486 deletions
+74
-486
VIZ.Framework.Common.Resource/Style/NumberBox/NumberBox.xaml
+0
-93
VIZ.Framework.Common.Resource/VIZ.Framework.Common.Resource.csproj
+6
-4
VIZ.Framework.Common.Resource/packages.config
+5
-0
VIZ.Framework.Common/Themes/Generic.xaml
+0
-1
VIZ.Framework.Common/VIZ.Framework.Common.csproj
+0
-5
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
+32
-10
VIZ.Framework.Common/Widgets/NumberBox/NumberBox.cs
+0
-289
VIZ.Framework.Common/Widgets/NumberBox/NumberBox.xaml
+0
-54
VIZ.Framework.Core/Core/Enum/EnumHelper.cs
+1
-1
VIZ.Framework.Core/Core/Helper/FPSHelper.cs
+10
-0
VIZ.Framework.Domain/Enum/RockerDirection.cs
+0
-26
VIZ.Framework.Domain/VIZ.Framework.Domain.csproj
+9
-1
VIZ.Framework.Domain/packages.config
+5
-0
VIZ.Framework.Storage/Ini/Config/VideoConfig.cs
+6
-0
VIZ.Framework.WpfTest/NumberBoxTest/NumberBoxTest.xaml
+0
-2
No files found.
VIZ.Framework.Common.Resource/Style/NumberBox/NumberBox.xaml
deleted
100644 → 0
View file @
c4d5b0a0
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:common="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common">
<core:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter" TrueVisibility="Visible" FalseVisibility="Collapsed"></core:Bool2VisibilityConverter>
<Style TargetType="RepeatButton" x:Key="NumberBox_Up">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border x:Name="border" Background="Transparent">
<Image Source="/VIZ.Framework.Common.Resource;component/Icons/triangle_up_16x16.png" Width="6" Height="13"
VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,5"></Image>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#22FFFFFF"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="RepeatButton" x:Key="NumberBox_Down">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RepeatButton">
<Border x:Name="border" Background="Transparent">
<Image Source="/VIZ.Framework.Common.Resource;component/Icons/triangle_down_16x16.png" Width="6" Height="13"
VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0,5,0,0"></Image>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border" Property="Background" Value="#22FFFFFF"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="common:NumberBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Background" Value="#ff0e131e"/>
<Setter Property="BorderBrush" Value="#ff3d4758"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="16"></Setter>
<Setter Property="BorderThickness" Value="0,0,0,1"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="common:NumberBox">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" Margin="5,0,5,0"
VerticalScrollBarVisibility="Hidden" VerticalContentAlignment="Center" Grid.RowSpan="2"/>
<RepeatButton x:Name="PART_Up" Style="{StaticResource NumberBox_Up}" Width="30"
Visibility="{TemplateBinding IsShowUpAndDownButton,Converter={StaticResource Bool2VisibilityConverter}}"
Grid.Column="1" Grid.Row="0" Content="Up"></RepeatButton>
<RepeatButton x:Name="PART_Down" Style="{StaticResource NumberBox_Down}" Width="30"
Visibility="{TemplateBinding IsShowUpAndDownButton,Converter={StaticResource Bool2VisibilityConverter}}"
Grid.Column="1" Grid.Row="1" Content="Down"></RepeatButton>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
VIZ.Framework.Common.Resource/VIZ.Framework.Common.Resource.csproj
View file @
aa923f0f
...
@@ -50,8 +50,13 @@
...
@@ -50,8 +50,13 @@
<ErrorReport>prompt</ErrorReport>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\VIZ.TVP.Golf\VIZ.TVP.Golf\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Core" />
...
@@ -86,10 +91,6 @@
...
@@ -86,10 +91,6 @@
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<SubType>Designer</SubType>
</Page>
</Page>
<Page Include="Style\NumberBox\NumberBox.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Style\ScrollView\ScrollView_Default.xaml">
<Page Include="Style\ScrollView\ScrollView_Default.xaml">
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<SubType>Designer</SubType>
...
@@ -122,6 +123,7 @@
...
@@ -122,6 +123,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</EmbeddedResource>
<None Include="app.config" />
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
...
...
VIZ.Framework.Common.Resource/packages.config
0 → 100644
View file @
aa923f0f
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"log4net"
version
=
"2.0.14"
targetFramework
=
"net48"
/>
</
packages
>
\ No newline at end of file
VIZ.Framework.Common/Themes/Generic.xaml
View file @
aa923f0f
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
<ResourceDictionary Source="/VIZ.Framework.Common;component/MessageBox/MessageBoxEx.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/MessageBox/MessageBoxEx.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/VideoTimeBar/VideoTimeBar.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/VideoTimeBar/VideoTimeBar.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/NavigationControl/NavigationControl.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/NavigationControl/NavigationControl.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/NumberBox/NumberBox.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/ColorPickButton/ColorPickButton.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/ColorPickButton/ColorPickButton.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/LabelValue/LabelValue.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/LabelValue/LabelValue.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/HotkeyBox/HotkeyBox.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.Framework.Common;component/Widgets/HotkeyBox/HotkeyBox.xaml"></ResourceDictionary>
...
...
VIZ.Framework.Common/VIZ.Framework.Common.csproj
View file @
aa923f0f
...
@@ -173,10 +173,6 @@
...
@@ -173,10 +173,6 @@
<SubType>Designer</SubType>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
</Page>
</Page>
<Page Include="Widgets\NumberBox\NumberBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Widgets\ShowMessageControl\ShowMessageControl.xaml">
<Page Include="Widgets\ShowMessageControl\ShowMessageControl.xaml">
<SubType>Designer</SubType>
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
...
@@ -310,7 +306,6 @@
...
@@ -310,7 +306,6 @@
<Compile Include="Widgets\NavigationControl\NavigationControl.cs" />
<Compile Include="Widgets\NavigationControl\NavigationControl.cs" />
<Compile Include="Widgets\NavigationControl\NavigationItemControl.cs" />
<Compile Include="Widgets\NavigationControl\NavigationItemControl.cs" />
<Compile Include="Widgets\NoneWindow\NoneWindow.cs" />
<Compile Include="Widgets\NoneWindow\NoneWindow.cs" />
<Compile Include="Widgets\NumberBox\NumberBox.cs" />
<Compile Include="Widgets\ShowMessageControl\ShowMessage.cs" />
<Compile Include="Widgets\ShowMessageControl\ShowMessage.cs" />
<Compile Include="Widgets\ShowMessageControl\ShowMessageControl.cs" />
<Compile Include="Widgets\ShowMessageControl\ShowMessageControl.cs" />
<Compile Include="Widgets\TimeDisplayControl\TimeDisplayControl.cs" />
<Compile Include="Widgets\TimeDisplayControl\TimeDisplayControl.cs" />
...
...
VIZ.Framework.Common/VideoControl/Sync/VideoControlSyncQueue.cs
View file @
aa923f0f
...
@@ -3,10 +3,13 @@ using System.Collections.Concurrent;
...
@@ -3,10 +3,13 @@ using System.Collections.Concurrent;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Runtime.CompilerServices
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
log4net
;
using
log4net
;
using
VIZ.Framework.Domain
;
using
VIZ.Framework.Storage
;
namespace
VIZ.Framework.Common
namespace
VIZ.Framework.Common
{
{
...
@@ -24,12 +27,14 @@ namespace VIZ.Framework.Common
...
@@ -24,12 +27,14 @@ namespace VIZ.Framework.Common
private
static
readonly
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
VideoControlSyncQueue
));
private
static
readonly
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
VideoControlSyncQueue
));
/// <summary>
/// <summary>
/// 是否同步视频和数据帧
/// </summary>
private
static
readonly
bool
VIDEO_IS_SYNC_VIDEO_AND_DATA_FRAME
=
ApplicationDomain
.
IniStorage
.
GetValue
<
VideoConfig
,
bool
>(
p
=>
p
.
VIDEO_IS_SYNC_VIDEO_AND_DATA_FRAME
);
/// <summary>
/// 最大队列长度
/// 最大队列长度
/// </summary>
/// </summary>
/// <remarks>
public
int
MaxQueueCount
{
get
;
set
;
}
=
25
;
/// 40ms * 50 = 2s
/// </remarks>
public
int
MaxQueueCount
{
get
;
set
;
}
=
50
;
/// <summary>
/// <summary>
/// 帧同步时触发
/// 帧同步时触发
...
@@ -84,6 +89,18 @@ namespace VIZ.Framework.Common
...
@@ -84,6 +89,18 @@ namespace VIZ.Framework.Common
}
}
/// <summary>
/// <summary>
/// 清理视频数据帧
/// </summary>
public
void
ClearDataFrame
()
{
while
(
this
.
DataFrameQueue
.
Count
>
0
)
{
this
.
DataFrameQueue
.
TryDequeue
(
out
_
);
}
this
.
DataFrame
=
null
;
}
/// <summary>
/// 执行不需要对齐并且处理视频帧
/// 执行不需要对齐并且处理视频帧
/// </summary>
/// </summary>
public
void
ExecuteVideo
()
public
void
ExecuteVideo
()
...
@@ -109,6 +126,10 @@ namespace VIZ.Framework.Common
...
@@ -109,6 +126,10 @@ namespace VIZ.Framework.Common
{
{
try
try
{
{
// 在队列未达到长度之前不需要处理
if
(
this
.
VideoFrameQueue
.
Count
<
this
.
MaxQueueCount
)
return
;
while
(
true
)
while
(
true
)
{
{
IVideoControlSync
video
=
this
.
VideoFrame
;
IVideoControlSync
video
=
this
.
VideoFrame
;
...
@@ -124,19 +145,20 @@ namespace VIZ.Framework.Common
...
@@ -124,19 +145,20 @@ namespace VIZ.Framework.Common
this
.
DataFrameQueue
.
TryDequeue
(
out
data
);
this
.
DataFrameQueue
.
TryDequeue
(
out
data
);
}
}
int
videoQueueCount
=
this
.
VideoFrameQueue
.
Count
;
// 没有视频帧时不处理
// 没有视频帧时不处理
if
(
video
==
null
)
if
(
video
==
null
)
return
;
return
;
// 如果配置为不需要处理视频与数据帧同步那么直接处理获取到的最新的数据
if
(!
VIDEO_IS_SYNC_VIDEO_AND_DATA_FRAME
)
{
this
.
triggerEvent
(
video
,
data
);
return
;
}
// 有视频帧 没有数据帧
// 有视频帧 没有数据帧
if
(
data
==
null
)
if
(
data
==
null
)
{
{
// 如果视频帧队列在等待队列长度范围内,那么不处理
if
(
videoQueueCount
<
this
.
MaxQueueCount
)
return
;
// 处理数据
// 处理数据
this
.
triggerEvent
(
video
,
null
);
this
.
triggerEvent
(
video
,
null
);
this
.
VideoFrame
=
null
;
this
.
VideoFrame
=
null
;
...
...
VIZ.Framework.Common/Widgets/NumberBox/NumberBox.cs
deleted
100644 → 0
View file @
c4d5b0a0
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Controls.Primitives
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
VIZ.Framework.Core
;
namespace
VIZ.Framework.Common
{
/// <summary>
/// 数字输入框
/// </summary>
[
TemplatePart
(
Name
=
nameof
(
PART_Up
),
Type
=
typeof
(
RepeatButton
))]
[
TemplatePart
(
Name
=
nameof
(
PART_Down
),
Type
=
typeof
(
RepeatButton
))]
public
class
NumberBox
:
TextBox
{
static
NumberBox
()
{
DefaultStyleKeyProperty
.
OverrideMetadata
(
typeof
(
NumberBox
),
new
FrameworkPropertyMetadata
(
typeof
(
NumberBox
)));
}
public
NumberBox
()
{
this
.
SetCurrentValue
(
NumberBox
.
TextProperty
,
this
.
MinValue
.
ToString
());
}
#
region
MinValue
--
最小值
/// <summary>
/// 最小值
/// </summary>
public
double
MinValue
{
get
{
return
(
double
)
GetValue
(
MinValueProperty
);
}
set
{
SetValue
(
MinValueProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for MinValue. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
MinValueProperty
=
DependencyProperty
.
Register
(
"MinValue"
,
typeof
(
double
),
typeof
(
NumberBox
),
new
PropertyMetadata
(
0d
));
#
endregion
#
region
MaxValue
--
最大值
/// <summary>
/// 最大值
/// </summary>
public
double
MaxValue
{
get
{
return
(
double
)
GetValue
(
MaxValueProperty
);
}
set
{
SetValue
(
MaxValueProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for MaxValue. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
MaxValueProperty
=
DependencyProperty
.
Register
(
"MaxValue"
,
typeof
(
double
),
typeof
(
NumberBox
),
new
PropertyMetadata
(
100d
));
#
endregion
#
region
Value
--
当前值
/// <summary>
/// 当前值
/// </summary>
public
double
Value
{
get
{
return
(
double
)
GetValue
(
ValueProperty
);
}
set
{
SetValue
(
ValueProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for Value. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
ValueProperty
=
DependencyProperty
.
Register
(
"Value"
,
typeof
(
double
),
typeof
(
NumberBox
),
new
PropertyMetadata
(
0d
,
new
PropertyChangedCallback
((
s
,
e
)
=>
{
(
s
as
NumberBox
).
Text
=
((
double
)
e
.
NewValue
).
ToString
();
})));
#
endregion
#
region
Interval
--
间隔值
/// <summary>
/// 间隔值
/// </summary>
public
double
Interval
{
get
{
return
(
double
)
GetValue
(
IntervalProperty
);
}
set
{
SetValue
(
IntervalProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for Interval. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
IntervalProperty
=
DependencyProperty
.
Register
(
"Interval"
,
typeof
(
double
),
typeof
(
NumberBox
),
new
PropertyMetadata
(
1d
,
new
PropertyChangedCallback
((
s
,
e
)
=>
{
// 重置正则表达式
(
s
as
NumberBox
).
ResetRegex
();
})));
#
endregion
#
region
IsShowUpAndDownButton
--
是否显示上下按钮
/// <summary>
/// 是否显示上下按钮
/// </summary>
public
bool
IsShowUpAndDownButton
{
get
{
return
(
bool
)
GetValue
(
IsShowUpAndDownButtonProperty
);
}
set
{
SetValue
(
IsShowUpAndDownButtonProperty
,
value
);
}
}
/// <summary>
/// Using a DependencyProperty as the backing store for IsShowUpAndDownButton. This enables animation, styling, binding, etc...
/// </summary>
public
static
readonly
DependencyProperty
IsShowUpAndDownButtonProperty
=
DependencyProperty
.
Register
(
"IsShowUpAndDownButton"
,
typeof
(
bool
),
typeof
(
NumberBox
),
new
PropertyMetadata
(
true
));
#
endregion
/// <summary>
/// 向上按钮
/// </summary>
private
RepeatButton
PART_Up
;
/// <summary>
/// 向下按钮
/// </summary>
private
RepeatButton
PART_Down
;
/// <summary>
/// 之前的文本值
/// </summary>
private
string
old_text
;
/// <summary>
/// 数字正则表达式
/// </summary>
private
Regex
regex
;
/// <summary>
/// 应用模板
/// </summary>
public
override
void
OnApplyTemplate
()
{
base
.
OnApplyTemplate
();
this
.
PART_Up
=
this
.
Template
.
FindName
(
nameof
(
PART_Up
),
this
)
as
RepeatButton
;
this
.
PART_Down
=
this
.
Template
.
FindName
(
nameof
(
PART_Down
),
this
)
as
RepeatButton
;
if
(
this
.
PART_Up
!=
null
)
{
this
.
PART_Up
.
Click
-=
PART_Up_Click
;
this
.
PART_Up
.
Click
+=
PART_Up_Click
;
}
if
(
this
.
PART_Down
!=
null
)
{
this
.
PART_Down
.
Click
-=
PART_Down_Click
;
this
.
PART_Down
.
Click
+=
PART_Down_Click
;
}
}
/// <summary>
/// 失去焦点
/// </summary>
protected
override
void
OnLostFocus
(
RoutedEventArgs
e
)
{
base
.
OnLostFocus
(
e
);
if
(!
double
.
TryParse
(
this
.
Text
,
out
double
value
))
{
value
=
this
.
MinValue
;
}
value
=
MathHelper
.
Clip
(
this
.
MinValue
,
this
.
MaxValue
,
value
);
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
));
this
.
Text
=
value
.
ToString
();
this
.
Value
=
value
;
}
/// <summary>
/// 文本改变之后
/// </summary>
protected
override
void
OnTextChanged
(
TextChangedEventArgs
e
)
{
base
.
OnTextChanged
(
e
);
if
(
this
.
regex
==
null
)
{
this
.
ResetRegex
();
}
if
(!
this
.
regex
.
IsMatch
(
this
.
Text
))
{
this
.
Text
=
this
.
old_text
;
}
else
{
this
.
old_text
=
this
.
Text
;
}
}
/// <summary>
/// 向下
/// </summary>
private
void
PART_Down_Click
(
object
sender
,
RoutedEventArgs
e
)
{
double
value
=
this
.
Value
-
this
.
Interval
;
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
));
if
(
value
<
this
.
MinValue
||
value
>
this
.
MaxValue
)
return
;
this
.
Value
=
value
;
}
/// <summary>
/// 向上
/// </summary>
private
void
PART_Up_Click
(
object
sender
,
RoutedEventArgs
e
)
{
double
value
=
this
.
Value
+
this
.
Interval
;
value
=
Math
.
Round
(
value
,
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
));
if
(
value
<
this
.
MinValue
||
value
>
this
.
MaxValue
)
return
;
this
.
Value
=
value
;
}
/// <summary>
/// 重置正则表达式
/// </summary>
private
void
ResetRegex
()
{
double
precision
=
MathHelper
.
GetDigitsPrecision
(
this
.
Interval
);
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
"^"
);
if
(
this
.
MinValue
<
0
)
{
if
(
precision
>
0
)
{
sb
.
Append
(
"[-.]*"
);
}
else
{
sb
.
Append
(
"[-]*"
);
}
}
else
{
if
(
precision
>
0
)
{
sb
.
Append
(
"[.]*"
);
}
}
sb
.
Append
(
"[0-9]*"
);
if
(
precision
>
0
)
{
sb
.
Append
(
"[.]*[0-9]{0,"
+
precision
+
"}"
);
}
sb
.
Append
(
"$"
);
regex
=
new
Regex
(
sb
.
ToString
());
}
}
}
VIZ.Framework.Common/Widgets/NumberBox/NumberBox.xaml
deleted
100644 → 0
View file @
c4d5b0a0
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:local="clr-namespace:VIZ.Framework.Common">
<core:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter" TrueVisibility="Visible" FalseVisibility="Collapsed"></core:Bool2VisibilityConverter>
<Style TargetType="local:NumberBox">
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="VerticalContentAlignment" Value="Center"></Setter>
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
<Setter Property="HorizontalContentAlignment" Value="Left"/>
<Setter Property="AllowDrop" Value="true"/>
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:NumberBox">
<Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" Margin="5,0,5,0"
VerticalScrollBarVisibility="Hidden" VerticalContentAlignment="Center" Grid.RowSpan="2"/>
<RepeatButton x:Name="PART_Up" Width="60"
Visibility="{TemplateBinding IsShowUpAndDownButton,Converter={StaticResource Bool2VisibilityConverter}}"
Grid.Column="1" Grid.Row="0" Content="Up"></RepeatButton>
<RepeatButton x:Name="PART_Down" Width="60"
Visibility="{TemplateBinding IsShowUpAndDownButton,Converter={StaticResource Bool2VisibilityConverter}}"
Grid.Column="1" Grid.Row="1" Content="Down"></RepeatButton>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter Property="Opacity" TargetName="border" Value="0.56"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
VIZ.Framework.Core/Core/Enum/EnumHelper.cs
View file @
aa923f0f
...
@@ -66,7 +66,7 @@ namespace VIZ.Framework.Core
...
@@ -66,7 +66,7 @@ namespace VIZ.Framework.Core
continue
;
continue
;
EnumModel
model
=
new
EnumModel
();
EnumModel
model
=
new
EnumModel
();
model
.
Key
=
name
.
ToString
(
);
model
.
Key
=
Enum
.
Parse
(
type
,
name
.
ToString
()
);
model
.
Description
=
attribute
.
Description
;
model
.
Description
=
attribute
.
Description
;
models
.
Add
(
model
);
models
.
Add
(
model
);
...
...
VIZ.Framework.Core/Core/Helper/FPSHelper.cs
View file @
aa923f0f
...
@@ -17,6 +17,9 @@ namespace VIZ.Framework.Core
...
@@ -17,6 +17,9 @@ namespace VIZ.Framework.Core
/// </summary>
/// </summary>
private
readonly
static
List
<
FPSHelper
>
allHelpers
=
new
List
<
FPSHelper
>();
private
readonly
static
List
<
FPSHelper
>
allHelpers
=
new
List
<
FPSHelper
>();
/// <summary>
/// FPS计算辅助类
/// </summary>
public
FPSHelper
()
public
FPSHelper
()
{
{
lock
(
allHelpers
)
lock
(
allHelpers
)
...
@@ -25,6 +28,11 @@ namespace VIZ.Framework.Core
...
@@ -25,6 +28,11 @@ namespace VIZ.Framework.Core
}
}
}
}
/// <summary>
/// 当FPS改变时触发
/// </summary>
public
event
EventHandler
<
EventArgs
>
OnFpsChanged
;
#
region
Duration
--
持续时间(单位:秒)
#
region
Duration
--
持续时间(单位:秒)
private
int
duration
=
5
;
private
int
duration
=
5
;
...
@@ -118,6 +126,8 @@ namespace VIZ.Framework.Core
...
@@ -118,6 +126,8 @@ namespace VIZ.Framework.Core
this
.
frameCount
=
0
;
this
.
frameCount
=
0
;
this
.
lastFrameTime
=
this
.
stopwatch
.
ElapsedMilliseconds
;
this
.
lastFrameTime
=
this
.
stopwatch
.
ElapsedMilliseconds
;
this
.
OnFpsChanged
?.
Invoke
(
this
,
new
EventArgs
());
}
}
/// <summary>
/// <summary>
...
...
VIZ.Framework.Domain/Enum/RockerDirection.cs
deleted
100644 → 0
View file @
c4d5b0a0
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Framework.Domain
{
/// <summary>
/// 摇杆方向
/// </summary>
public
enum
RockerDirection
{
/// <summary>
/// 正向
/// </summary>
[
Description
(
"正向"
)]
Forward
=
1
,
/// <summary>
/// 反向
/// </summary>
[
Description
(
"反向"
)]
backward
=
2
}
}
VIZ.Framework.Domain/VIZ.Framework.Domain.csproj
View file @
aa923f0f
...
@@ -49,8 +49,13 @@
...
@@ -49,8 +49,13 @@
<ErrorReport>prompt</ErrorReport>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\..\VIZ.TVP.Golf\VIZ.TVP.Golf\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp" />
...
@@ -60,7 +65,6 @@
...
@@ -60,7 +65,6 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="ApplicationDomain.cs" />
<Compile Include="ApplicationDomain.cs" />
<Compile Include="Enum\RockerDirection.cs" />
<Compile Include="Model\Monitor\System\SystemMonitorGpuModel.cs" />
<Compile Include="Model\Monitor\System\SystemMonitorGpuModel.cs" />
<Compile Include="Model\Monitor\System\SystemMonitorModel.cs" />
<Compile Include="Model\Monitor\System\SystemMonitorModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
...
@@ -79,5 +83,8 @@
...
@@ -79,5 +83,8 @@
<Name>VIZ.Framework.Storage</Name>
<Name>VIZ.Framework.Storage</Name>
</ProjectReference>
</ProjectReference>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
\ No newline at end of file
VIZ.Framework.Domain/packages.config
0 → 100644
View file @
aa923f0f
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"log4net"
version
=
"2.0.14"
targetFramework
=
"net48"
/>
</
packages
>
\ No newline at end of file
VIZ.Framework.Storage/Ini/Config/VideoConfig.cs
View file @
aa923f0f
...
@@ -143,5 +143,11 @@ namespace VIZ.Framework.Storage
...
@@ -143,5 +143,11 @@ namespace VIZ.Framework.Storage
/// </summary>
/// </summary>
[
Ini
(
Section
=
"Video"
,
DefaultValue
=
"#44000000"
,
Type
=
typeof
(
RawColor4
))]
[
Ini
(
Section
=
"Video"
,
DefaultValue
=
"#44000000"
,
Type
=
typeof
(
RawColor4
))]
public
string
VIDEO_CENTER_AXIS_COLOR
{
get
;
set
;
}
public
string
VIDEO_CENTER_AXIS_COLOR
{
get
;
set
;
}
/// <summary>
/// 是否同步视频和数据帧
/// </summary>
[
Ini
(
Section
=
"Video"
,
DefaultValue
=
"true"
,
Type
=
typeof
(
bool
))]
public
string
VIDEO_IS_SYNC_VIDEO_AND_DATA_FRAME
{
get
;
set
;
}
}
}
}
}
VIZ.Framework.WpfTest/NumberBoxTest/NumberBoxTest.xaml
View file @
aa923f0f
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
<UserControl.Resources>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Framework.Common.Resource;component/Style/NumberBox/NumberBox.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</ResourceDictionary>
</UserControl.Resources>
</UserControl.Resources>
...
@@ -18,7 +17,6 @@
...
@@ -18,7 +17,6 @@
<Grid>
<Grid>
<TextBlock Text="{Binding ElementName=nb,Path=Value}"
<TextBlock Text="{Binding ElementName=nb,Path=Value}"
VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="36" Foreground="Red" Margin="0,0,0,140"></TextBlock>
VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="36" Foreground="Red" Margin="0,0,0,140"></TextBlock>
<fcommon:NumberBox x:Name="nb" Height="40" Width="240" Interval="0.01" Value="{Binding Path=Value,Mode=TwoWay}"></fcommon:NumberBox>
<Button Width="120" Height="30" Margin="0,200,0,0" Click="Button_Click"></Button>
<Button Width="120" Height="30" Margin="0,200,0,0" Click="Button_Click"></Button>
<Button Width="120" Height="30" Margin="400,200,0,0"></Button>
<Button Width="120" Height="30" Margin="400,200,0,0"></Button>
...
...
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