Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.ElectricRabbit
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.ElectricRabbit
Commits
2bfcb8c4
Commit
2bfcb8c4
authored
Oct 13, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置 支持
parent
97ed6f92
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
562 additions
and
17 deletions
+562
-17
VIZ.ElectricRabbit.Domain/ApplicationConstant.cs
+34
-0
VIZ.ElectricRabbit.Domain/ApplicationDomainEx.cs
+20
-0
VIZ.ElectricRabbit.Domain/Info/ClientConfigInfo.cs
+50
-0
VIZ.ElectricRabbit.Domain/VIZ.ElectricRabbit.Domain.csproj
+6
-0
VIZ.ElectricRabbit.Module.Resource/Style/CheckBox/CheckBox_Setting.xaml
+4
-1
VIZ.ElectricRabbit.Module/MainView/View/MainView.xaml
+4
-4
VIZ.ElectricRabbit.Module/MainView/ViewModel/MainViewModel.cs
+14
-0
VIZ.ElectricRabbit.Module/SettingView/View/SettingView.xaml
+24
-10
VIZ.ElectricRabbit.Module/SettingView/View/SettingView.xaml.cs
+0
-2
VIZ.ElectricRabbit.Module/SettingView/ViewModel/SettingViewModel.cs
+137
-0
VIZ.ElectricRabbit.Module/Setup/Provider/AppSetup_InitINI.cs
+89
-0
VIZ.ElectricRabbit.Module/VIZ.ElectricRabbit.Module.csproj
+1
-0
VIZ.ElectricRabbit.Storage/Ini/ClientConfig.cs
+58
-0
VIZ.ElectricRabbit.Storage/VIZ.ElectricRabbit.Storage.csproj
+4
-0
VIZ.ElectricRabbit/App.xaml.cs
+4
-0
VIZ.ElectricRabbit/VIZ.ElectricRabbit.csproj
+6
-0
VIZ.ElectricRabbit/config/config.ini
+33
-0
VIZ.ElectricRabbit/config/log.config
+74
-0
No files found.
VIZ.ElectricRabbit.Domain/ApplicationConstant.cs
0 → 100644
View file @
2bfcb8c4
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.ElectricRabbit.Domain
{
/// <summary>
/// 应用程序常量
/// </summary>
public
static
class
ApplicationConstant
{
/// <summary>
/// 视频宽度
/// </summary>
public
const
int
VIDEO_WIDTH
=
1920
;
/// <summary>
/// 视频宽度
/// </summary>
public
const
int
VIDEO_HEIGHT
=
1080
;
/// <summary>
/// 视频宽度 double 类型
/// </summary>
public
const
double
VIDEO_WIDTH__DOUBLE
=
VIDEO_WIDTH
;
/// <summary>
/// 视频宽度 double 类型
/// </summary>
public
const
double
VIDEO_HEIGHT__DOUBLE
=
VIDEO_HEIGHT
;
}
}
VIZ.ElectricRabbit.Domain/ApplicationDomainEx.cs
0 → 100644
View file @
2bfcb8c4
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Domain
;
namespace
VIZ.ElectricRabbit.Domain
{
/// <summary>
/// 应用程序域
/// </summary>
public
class
ApplicationDomainEx
:
ApplicationDomain
{
/// <summary>
/// 客户端配置信息
/// </summary>
public
static
ClientConfigInfo
ClientConfigInfo
{
get
;
private
set
;
}
=
new
ClientConfigInfo
();
}
}
VIZ.ElectricRabbit.Domain/Info/ClientConfigInfo.cs
0 → 100644
View file @
2bfcb8c4
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Media
;
namespace
VIZ.ElectricRabbit.Domain
{
/// <summary>
/// 客户端配置信息
/// </summary>
public
class
ClientConfigInfo
{
/// <summary>
/// 安全距离(单位:像素)
/// </summary>
public
int
SafeDistance
{
get
;
set
;
}
/// <summary>
/// 安全轴位置(单位:像素)
/// </summary>
public
int
SafeAxis
{
get
;
set
;
}
/// <summary>
/// 是否启用闪烁
/// </summary>
public
bool
IsFlashingEnabled
{
get
;
set
;
}
/// <summary>
/// 闪烁间隔
/// </summary>
public
double
FlashingInterval
{
get
;
set
;
}
/// <summary>
/// 方向向左颜色
/// </summary>
public
Color
LeftColor
{
get
;
set
;
}
/// <summary>
/// 方向向右颜色
/// </summary>
public
Color
RightColor
{
get
;
set
;
}
/// <summary>
/// 安全颜色
/// </summary>
public
Color
SafeColor
{
get
;
set
;
}
}
}
VIZ.ElectricRabbit.Domain/VIZ.ElectricRabbit.Domain.csproj
View file @
2bfcb8c4
...
...
@@ -52,18 +52,24 @@
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Windows" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="ApplicationConstant.cs" />
<Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Info\ClientConfigInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
...
...
VIZ.ElectricRabbit.Module.Resource/Style/CheckBox/CheckBox_Setting.xaml
View file @
2bfcb8c4
...
...
@@ -37,7 +37,7 @@
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid Background="Transparent">
<Image x:Name="img" Width="24" Height="24" RenderTransformOrigin="0.5,0.5"
<Image x:Name="img" Width="24" Height="24" RenderTransformOrigin="0.5,0.5"
Opacity="0.7"
Source="/VIZ.ElectricRabbit.Module.Resource;component/Icons/expand_right_24x24.png">
<Image.RenderTransform>
<RotateTransform Angle="-180"></RotateTransform>
...
...
@@ -52,6 +52,9 @@
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="img" Property="Opacity" Value="1"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
...
...
VIZ.ElectricRabbit.Module/MainView/View/MainView.xaml
View file @
2bfcb8c4
...
...
@@ -7,7 +7,8 @@
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:common="clr-namespace:VIZ.ElectricRabbit.Common;assembly=VIZ.ElectricRabbit.Common"
d:DataContext="{d:DesignInstance Type=local:MainViewModel}" Background="Transparent"
d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
Background="Transparent"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
...
...
@@ -32,8 +33,6 @@
<Grid Background="#ff12202d">
<TextBlock Text="电兔子" FontSize="12" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top">
<Button Command="{Binding Path=SettingCommand}" ToolTip="系统设置"
Style="{StaticResource Button_Setting}" Height="30"></Button>
<Button Command="{Binding Path=MinCommand}" ToolTip="最小化"
Style="{StaticResource Button_Min}" Height="30"></Button>
<Button Command="{Binding Path=CloseCommand}" ToolTip="关闭"
...
...
@@ -52,7 +51,8 @@
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 提示区域 -->
<fcommon:FlashingBorder IsFlashingEnabled="True" FlashingInterval="0:0:0.5">
<fcommon:FlashingBorder IsFlashingEnabled="{Binding Path=SettingViewModel.IsFlashingEnabled}"
FlashingInterval="{Binding Path=SettingViewModel.FlashingInterval}">
<common:ArrowShape ArrowMaxHeight="120" ArrowMaxWidth="120" ArrowMinHeigh="60" ArrowMinWidth="60"
RectangleMaxHeigh="40" RectangleMaxWidth="1200" RectangleMinHeigh="5" RectangleMinWidth="20"
SafeRectangleWidth="400" RectangleHeightProportion="0.4"
...
...
VIZ.ElectricRabbit.Module/MainView/ViewModel/MainViewModel.cs
View file @
2bfcb8c4
...
...
@@ -49,6 +49,20 @@ namespace VIZ.ElectricRabbit.Module
#
endregion
#
region
SettingViewModel
--
设置视图模型
private
SettingViewModel
settingViewModel
=
new
SettingViewModel
();
/// <summary>
/// 设置视图模型
/// </summary>
public
SettingViewModel
SettingViewModel
{
get
{
return
settingViewModel
;
}
set
{
settingViewModel
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SettingViewModel
));
}
}
#
endregion
// ================================================================================
// Command
// ================================================================================
...
...
VIZ.ElectricRabbit.Module/SettingView/View/SettingView.xaml
View file @
2bfcb8c4
...
...
@@ -6,7 +6,9 @@
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:domain="clr-namespace:VIZ.ElectricRabbit.Domain;assembly=VIZ.ElectricRabbit.Domain"
xmlns:local="clr-namespace:VIZ.ElectricRabbit.Module"
d:DataContext="{d:DesignInstance Type=local:MainViewModel}"
mc:Ignorable="d" d:Background="#ff12202d"
d:DesignHeight="1080" d:DesignWidth="400">
<UserControl.Resources>
...
...
@@ -21,7 +23,6 @@
</ResourceDictionary.MergedDictionaries>
<fcore:Color2SolidColorBrushConverter x:Key="Color2SolidColorBrushConverter"></fcore:Color2SolidColorBrushConverter>
</ResourceDictionary>
</UserControl.Resources>
...
...
@@ -51,17 +52,23 @@
<!-- 安全范围 -->
<TextBlock Text="安全范围(像素)" Foreground="#AAFFFFFF" VerticalAlignment="Center" FontSize="14"
Margin="10,0,10,0" Grid.Row="1"></TextBlock>
<toolkit:IntegerUpDown Grid.Row="1" Grid.Column="1" Height="30" Margin="10,0,10,0"></toolkit:IntegerUpDown>
<toolkit:IntegerUpDown Grid.Row="1" Grid.Column="1" Height="30" Margin="10,0,10,0"
Minimum="0" Maximum="{x:Static Member=domain:ApplicationConstant.VIDEO_WIDTH}"
Value="{Binding Path=SettingViewModel.SafeDistance,UpdateSourceTrigger=PropertyChanged}"></toolkit:IntegerUpDown>
<!-- 安全轴 -->
<TextBlock Text="安全轴位置" Foreground="#AAFFFFFF" VerticalAlignment="Center" FontSize="14" Grid.Row="2"
<TextBlock Text="安全轴位置
(像素)
" Foreground="#AAFFFFFF" VerticalAlignment="Center" FontSize="14" Grid.Row="2"
Margin="10,0,10,0"></TextBlock>
<Grid Grid.Row="2" Grid.Column="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Slider VerticalAlignment="Center" Margin="10,0,10,0" Style="{StaticResource Slider_Setting}"></Slider>
<toolkit:IntegerUpDown Grid.Column="1" Height="30" Margin="0,0,10,0"></toolkit:IntegerUpDown>
<Slider VerticalAlignment="Center" Margin="10,0,10,0" Style="{StaticResource Slider_Setting}"
Minimum="0" Maximum="{x:Static Member=domain:ApplicationConstant.VIDEO_WIDTH__DOUBLE}"
Value="{Binding Path=SettingViewModel.SafeAxis,Mode=TwoWay}"></Slider>
<toolkit:IntegerUpDown Grid.Column="1" Height="30" Margin="0,0,10,0"
Minimum="0" Maximum="{x:Static Member=domain:ApplicationConstant.VIDEO_WIDTH}"
Value="{Binding Path=SettingViewModel.SafeAxis,Mode=TwoWay}"></toolkit:IntegerUpDown>
</Grid>
</Grid>
<Rectangle Grid.Row="0" Height="1" VerticalAlignment="Bottom" Fill="#ff3d4758"></Rectangle>
...
...
@@ -86,11 +93,15 @@
<!-- 安全范围 -->
<TextBlock Text="是否启用闪烁" Foreground="#AAFFFFFF" VerticalAlignment="Center" FontSize="14"
Margin="10,0,10,0" Grid.Row="1"></TextBlock>
<CheckBox Grid.Row="1" Grid.Column="1" Style="{StaticResource CheckBox_Setting}" Margin="10,0,10,0"></CheckBox>
<CheckBox Grid.Row="1" Grid.Column="1" Style="{StaticResource CheckBox_Setting}" Margin="10,0,10,0"
Height="30" Width="60" HorizontalAlignment="Left"
IsChecked="{Binding Path=SettingViewModel.IsFlashingEnabled,Mode=TwoWay}"></CheckBox>
<!-- 闪烁间隔 -->
<TextBlock Text="闪烁间隔(秒)" Foreground="#AAFFFFFF" VerticalAlignment="Center" FontSize="14" Grid.Row="2"
Margin="10,0,10,0"></TextBlock>
<toolkit:IntegerUpDown Grid.Row="2" Grid.Column="1" Height="30" Margin="10,0,10,0"></toolkit:IntegerUpDown>
<toolkit:DoubleUpDown Grid.Row="2" Grid.Column="1" Height="30" Margin="10,0,10,0"
Minimum="0.3" Maximum="5"
Value="{Binding Path=SettingViewModel.FlashingInterval,Mode=TwoWay}"></toolkit:DoubleUpDown>
<!-- 配色 -->
<TextBlock Text="配色" Foreground="#AAFFFFFF" VerticalAlignment="Center" FontSize="14" Grid.Row="3"
Margin="10,0,10,0"></TextBlock>
...
...
@@ -100,16 +111,19 @@
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<fcommon:ColorPickButton Style="{StaticResource ColorPickButton_Setting}">
<fcommon:ColorPickButton Style="{StaticResource ColorPickButton_Setting}"
Color="{Binding Path=SettingViewModel.LeftColor,Mode=TwoWay}">
<Path Data="{StaticResource ResourceKey=ARROW_RESOURCE_LEFT}"
Fill="{Binding Path=Color,RelativeSource={RelativeSource AncestorLevel=1,Mode=FindAncestor,AncestorType=fcommon:ColorPickButton},Converter={StaticResource Color2SolidColorBrushConverter}}"
Stretch="Fill" Width="40" Height="20"></Path>
</fcommon:ColorPickButton>
<fcommon:ColorPickButton Grid.Column="1" Style="{StaticResource ColorPickButton_Setting}">
<fcommon:ColorPickButton Grid.Column="1" Style="{StaticResource ColorPickButton_Setting}"
Color="{Binding Path=SettingViewModel.SafeColor,Mode=TwoWay}">
<Rectangle Width="40" Height="20"
Fill="{Binding Path=Color,RelativeSource={RelativeSource AncestorLevel=1,Mode=FindAncestor,AncestorType=fcommon:ColorPickButton},Converter={StaticResource Color2SolidColorBrushConverter}}" ></Rectangle>
</fcommon:ColorPickButton>
<fcommon:ColorPickButton Grid.Column="2" Style="{StaticResource ColorPickButton_Setting}">
<fcommon:ColorPickButton Grid.Column="2" Style="{StaticResource ColorPickButton_Setting}"
Color="{Binding Path=SettingViewModel.RightColor,Mode=TwoWay}">
<Path Data="{StaticResource ResourceKey=ARROW_RESOURCE_RIGHT}"
Stretch="Fill" Width="40" Height="20"
Fill="{Binding Path=Color,RelativeSource={RelativeSource AncestorLevel=1,Mode=FindAncestor,AncestorType=fcommon:ColorPickButton},Converter={StaticResource Color2SolidColorBrushConverter}}" ></Path>
...
...
VIZ.ElectricRabbit.Module/SettingView/View/SettingView.xaml.cs
View file @
2bfcb8c4
...
...
@@ -24,8 +24,6 @@ namespace VIZ.ElectricRabbit.Module
public
SettingView
()
{
InitializeComponent
();
WPFHelper
.
BindingViewModel
(
this
,
new
SettingViewModel
());
}
}
}
VIZ.ElectricRabbit.Module/SettingView/ViewModel/SettingViewModel.cs
View file @
2bfcb8c4
...
...
@@ -3,6 +3,12 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Web.Configuration
;
using
System.Web.UI.HtmlControls
;
using
System.Windows.Media
;
using
VIZ.ElectricRabbit.Domain
;
using
VIZ.ElectricRabbit.Storage
;
using
VIZ.Framework.Common
;
using
VIZ.Framework.Core
;
namespace
VIZ.ElectricRabbit.Module
...
...
@@ -12,6 +18,137 @@ namespace VIZ.ElectricRabbit.Module
/// </summary>
public
class
SettingViewModel
:
ViewModelBase
{
#
region
SafeDistance
--
安全距离(单位:像素)
private
int
safeDistance
=
ApplicationDomainEx
.
ClientConfigInfo
.
SafeDistance
;
/// <summary>
/// 安全距离(单位:像素)
/// </summary>
public
int
SafeDistance
{
get
{
return
safeDistance
;
}
set
{
safeDistance
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SafeDistance
));
ApplicationDomainEx
.
ClientConfigInfo
.
SafeDistance
=
value
;
}
}
#
endregion
#
region
SafeAxis
--
安全轴位置(单位:像素)
private
int
safeAxis
=
ApplicationDomainEx
.
ClientConfigInfo
.
SafeAxis
;
/// <summary>
/// 安全轴位置(单位:像素)
/// </summary>
public
int
SafeAxis
{
get
{
return
safeAxis
;
}
set
{
safeAxis
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SafeAxis
));
ApplicationDomainEx
.
ClientConfigInfo
.
SafeAxis
=
value
;
}
}
#
endregion
#
region
IsFlashingEnabled
--
是否启用闪烁
private
bool
isFlashingEnabled
=
ApplicationDomainEx
.
ClientConfigInfo
.
IsFlashingEnabled
;
/// <summary>
/// 是否启用闪烁
/// </summary>
public
bool
IsFlashingEnabled
{
get
{
return
isFlashingEnabled
;
}
set
{
isFlashingEnabled
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsFlashingEnabled
));
ApplicationDomainEx
.
ClientConfigInfo
.
IsFlashingEnabled
=
value
;
}
}
#
endregion
#
region
FlashingInterval
--
闪烁间隔
private
double
flashingInterval
=
ApplicationDomainEx
.
ClientConfigInfo
.
FlashingInterval
;
/// <summary>
/// 闪烁间隔
/// </summary>
public
double
FlashingInterval
{
get
{
return
flashingInterval
;
}
set
{
flashingInterval
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
FlashingInterval
));
ApplicationDomainEx
.
ClientConfigInfo
.
FlashingInterval
=
value
;
}
}
#
endregion
#
region
LeftColor
--
方向向左颜色
private
Color
leftColor
=
ApplicationDomainEx
.
ClientConfigInfo
.
LeftColor
;
/// <summary>
/// 方向向左颜色
/// </summary>
public
Color
LeftColor
{
get
{
return
leftColor
;
}
set
{
leftColor
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
LeftColor
));
ApplicationDomainEx
.
ClientConfigInfo
.
LeftColor
=
value
;
}
}
#
endregion
#
region
RightColor
--
方向向右颜色
private
Color
rightColor
=
ApplicationDomainEx
.
ClientConfigInfo
.
RightColor
;
/// <summary>
/// 方向向右颜色
/// </summary>
public
Color
RightColor
{
get
{
return
rightColor
;
}
set
{
rightColor
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
RightColor
));
ApplicationDomainEx
.
ClientConfigInfo
.
RightColor
=
value
;
}
}
#
endregion
#
region
SafeColor
--
安全颜色
private
Color
safeColor
=
ApplicationDomainEx
.
ClientConfigInfo
.
SafeColor
;
/// <summary>
/// 安全颜色
/// </summary>
public
Color
SafeColor
{
get
{
return
safeColor
;
}
set
{
safeColor
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SafeColor
));
ApplicationDomainEx
.
ClientConfigInfo
.
SafeColor
=
value
;
}
}
#
endregion
}
}
VIZ.ElectricRabbit.Module/Setup/Provider/AppSetup_InitINI.cs
0 → 100644
View file @
2bfcb8c4
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Media
;
using
VIZ.ElectricRabbit.Domain
;
using
VIZ.ElectricRabbit.Storage
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Domain
;
using
VIZ.Framework.Module
;
namespace
VIZ.ElectricRabbit.Module
{
/// <summary>
/// 应用程序启动 -- 初始化INI
/// </summary>
public
class
AppSetup_InitINI
:
AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_InitINI
));
/// <summary>
/// 描述
/// </summary>
public
override
string
Detail
{
get
;
}
=
"应用程序启动 -- 初始化INI"
;
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public
override
bool
Setup
(
AppSetupContext
context
)
{
// 安全距离
ApplicationDomainEx
.
ClientConfigInfo
.
SafeDistance
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
int
>(
p
=>
p
.
CLIENT_SAFE_DISTANCE
);
// 安全轴位置
ApplicationDomainEx
.
ClientConfigInfo
.
SafeAxis
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
int
>(
p
=>
p
.
CLIENT_SAFE_AXIS
);
// 是否启用闪烁
ApplicationDomainEx
.
ClientConfigInfo
.
IsFlashingEnabled
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
bool
>(
p
=>
p
.
CLIENT_IS_FLASHING_ENABLED
);
// 闪烁间隔
ApplicationDomainEx
.
ClientConfigInfo
.
FlashingInterval
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
double
>(
p
=>
p
.
CLIENT_FLASHING_INTERVAL
);
// 方向向左箭头颜色
ApplicationDomainEx
.
ClientConfigInfo
.
LeftColor
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
Color
>(
p
=>
p
.
CLIENT_LEFT_COLOR
);
// 方向向右箭头颜色
ApplicationDomainEx
.
ClientConfigInfo
.
RightColor
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
Color
>(
p
=>
p
.
CLIENT_RIGHT_COLOR
);
// 安全颜色
ApplicationDomainEx
.
ClientConfigInfo
.
SafeColor
=
ApplicationDomainEx
.
IniStorage
.
GetValue
<
ClientConfig
,
Color
>(
p
=>
p
.
CLIENT_SAFE_COLOR
);
// 注册保存任务
ApplicationDomainEx
.
LoopManager
.
Register
(
"AppSetup_InitINI.saveIni"
,
30
,
this
.
saveIni
);
return
true
;
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public
override
void
Shutdown
(
AppSetupContext
context
)
{
this
.
saveIni
();
}
/// <summary>
/// 保存INI配置
/// </summary>
private
void
saveIni
()
{
// 安全距离
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_SAFE_DISTANCE
,
ApplicationDomainEx
.
ClientConfigInfo
.
SafeDistance
);
// 安全轴位置
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_SAFE_AXIS
,
ApplicationDomainEx
.
ClientConfigInfo
.
SafeAxis
);
// 是否启用闪烁
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_IS_FLASHING_ENABLED
,
ApplicationDomainEx
.
ClientConfigInfo
.
IsFlashingEnabled
);
// 闪烁间隔
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_FLASHING_INTERVAL
,
ApplicationDomainEx
.
ClientConfigInfo
.
FlashingInterval
);
// 方向向左箭头颜色
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_LEFT_COLOR
,
ApplicationDomainEx
.
ClientConfigInfo
.
LeftColor
);
// 方向向右箭头颜色
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_RIGHT_COLOR
,
ApplicationDomainEx
.
ClientConfigInfo
.
RightColor
);
// 安全颜色
ApplicationDomainEx
.
IniStorage
.
SetValue
<
ClientConfig
>(
p
=>
p
.
CLIENT_SAFE_COLOR
,
ApplicationDomainEx
.
ClientConfigInfo
.
SafeColor
);
}
}
}
\ No newline at end of file
VIZ.ElectricRabbit.Module/VIZ.ElectricRabbit.Module.csproj
View file @
2bfcb8c4
...
...
@@ -124,6 +124,7 @@
<Compile Include="SettingView\View\SettingView.xaml.cs">
<DependentUpon>SettingView.xaml</DependentUpon>
</Compile>
<Compile Include="Setup\Provider\AppSetup_InitINI.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
...
...
VIZ.ElectricRabbit.Storage/Ini/ClientConfig.cs
0 → 100644
View file @
2bfcb8c4
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Media
;
using
VIZ.Framework.Storage
;
namespace
VIZ.ElectricRabbit.Storage
{
/// <summary>
/// 客户端配置
/// </summary>
public
class
ClientConfig
:
IniConfigBase
{
/// <summary>
/// 安全范围(单位:像素)
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"200"
,
Type
=
typeof
(
int
))]
public
string
CLIENT_SAFE_DISTANCE
{
get
;
set
;
}
/// <summary>
/// 安全轴位置(单位:像素)
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"200"
,
Type
=
typeof
(
int
))]
public
string
CLIENT_SAFE_AXIS
{
get
;
set
;
}
/// <summary>
/// 是否使用闪烁
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"false"
,
Type
=
typeof
(
bool
))]
public
string
CLIENT_IS_FLASHING_ENABLED
{
get
;
set
;
}
/// <summary>
/// 闪烁间隔(单位:秒)
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"1"
,
Type
=
typeof
(
double
))]
public
string
CLIENT_FLASHING_INTERVAL
{
get
;
set
;
}
/// <summary>
/// 箭头向左颜色(格式:#AARRGGBB)
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"#FF0000FF"
,
Type
=
typeof
(
Color
))]
public
string
CLIENT_LEFT_COLOR
{
get
;
set
;
}
/// <summary>
/// 箭头向右颜色(格式:#AARRGGBB)
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"#FFFF0000"
,
Type
=
typeof
(
Color
))]
public
string
CLIENT_RIGHT_COLOR
{
get
;
set
;
}
/// <summary>
/// 箭头安全颜色(格式:#AARRGGBB)
/// </summary>
[
Ini
(
Section
=
"Client"
,
DefaultValue
=
"#FF00FF00"
,
Type
=
typeof
(
Color
))]
public
string
CLIENT_SAFE_COLOR
{
get
;
set
;
}
}
}
VIZ.ElectricRabbit.Storage/VIZ.ElectricRabbit.Storage.csproj
View file @
2bfcb8c4
...
...
@@ -52,18 +52,22 @@
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Windows" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Ini\ClientConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
...
...
VIZ.ElectricRabbit/App.xaml.cs
View file @
2bfcb8c4
...
...
@@ -5,6 +5,7 @@ using System.Data;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
VIZ.ElectricRabbit.Module
;
using
VIZ.Framework.Module
;
namespace
VIZ.ElectricRabbit
...
...
@@ -16,6 +17,9 @@ namespace VIZ.ElectricRabbit
{
public
App
()
{
// 初始化 INI
AppSetup
.
AppendSetup
(
new
AppSetup_InitINI
());
// 执行启动流程
AppSetupContext
context
=
AppSetup
.
Setup
();
...
...
VIZ.ElectricRabbit/VIZ.ElectricRabbit.csproj
View file @
2bfcb8c4
...
...
@@ -132,6 +132,12 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="config\config.ini">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\log.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
...
...
VIZ.ElectricRabbit/config/config.ini
0 → 100644
View file @
2bfcb8c4
; ============================================================
; === Application ===
; ============================================================
[Application]
; 是否是调试模式
APPLICATION_IS_DEBUG
=
false
; ============================================================
; === Video ===
; ============================================================
[Video]
; 视频是否显示FPS
VIDEO_IS_SHOW_FPS
=
false
; 视频渲染等待(单位:毫秒)
VIDEO_RENDER_WAIT
=
10
; ============================================================
; === Client ===
; ============================================================
[Client]
; 安全范围(单位:像素)
CLIENT_SAFE_DISTANCE
=
200
; 安全轴位置(单位:像素)
CLIENT_SAFE_AXIS
=
960
; 是否使用闪烁
CLIENT_IS_FLASHING_ENABLED
=
false
; 闪烁间隔(单位:秒)
CLIENT_FLASHING_INTERVAL
=
1
; 箭头向左颜色(格式:#AARRGGBB)
CLIENT_LEFT_COLOR
=
#FF0000FF
; 箭头向右颜色(格式:#AARRGGBB)
CLIENT_RIGHT_COLOR=#FFFF0000
; 箭头安全颜色(格式:#AARRGGBB)
CLIENT_SAFE_COLOR
=
#FF00FF00
\ No newline at end of file
VIZ.ElectricRabbit/config/log.config
0 → 100644
View file @
2bfcb8c4
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
log4net
>
<
appender
name
=
"errorAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
<
filter
type
=
"log4net.Filter.LevelMatchFilter"
>
<
levelToMatch
value
=
"ERROR"
/>
</
filter
>
<
filter
type
=
"log4net.Filter.DenyAllFilter"
/>
<
file
value
=
"Logs\err.log"
/>
<
encoding
value
=
"utf-8"
/>
<
preserveLogFileNameExtension
value
=
"true"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyyMMdd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"%date [%thread] %-5level %logger - %message%newline"
/>
</
layout
>
</
appender
>
<
appender
name
=
"infoAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
<
filter
type
=
"log4net.Filter.LevelMatchFilter"
>
<
levelToMatch
value
=
"INFO"
/>
</
filter
>
<
filter
type
=
"log4net.Filter.DenyAllFilter"
/>
<
file
value
=
"Logs\info.log"
/>
<
encoding
value
=
"utf-8"
/>
<
preserveLogFileNameExtension
value
=
"true"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyyMMdd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"%date [%thread] %-5level %logger - %message%newline"
/>
</
layout
>
</
appender
>
<
appender
name
=
"debugAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
<
filter
type
=
"log4net.Filter.LevelMatchFilter"
>
<
levelToMatch
value
=
"DEBUG"
/>
</
filter
>
<
filter
type
=
"log4net.Filter.DenyAllFilter"
/>
<
file
value
=
"Logs\debug.log"
/>
<
encoding
value
=
"utf-8"
/>
<
preserveLogFileNameExtension
value
=
"true"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyyMMdd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"%date [%thread] %-5level %logger - %message%newline"
/>
</
layout
>
</
appender
>
<
appender
name
=
"perfAppender"
type
=
"log4net.Appender.RollingFileAppender"
>
<
filter
type
=
"log4net.Filter.LevelMatchFilter"
>
<
levelToMatch
value
=
"INFO"
/>
</
filter
>
<
filter
type
=
"log4net.Filter.DenyAllFilter"
/>
<
file
value
=
"Logs\perf.log"
/>
<
encoding
value
=
"utf-8"
/>
<
preserveLogFileNameExtension
value
=
"true"
/>
<
appendToFile
value
=
"true"
/>
<
rollingStyle
value
=
"Date"
/>
<
datePattern
value
=
"yyyyMMdd"
/>
<
layout
type
=
"log4net.Layout.PatternLayout"
>
<
conversionPattern
value
=
"%date %logger - %message%newline"
/>
</
layout
>
</
appender
>
<
root
>
<
level
value
=
"ALL"
/>
<
appender
-
ref
ref
=
"errorAppender"
/>
<
appender
-
ref
ref
=
"infoAppender"
/>
<
appender
-
ref
ref
=
"debugAppender"
/>
</
root
>
<
logger
name
=
"Performance"
additivity
=
"false"
>
<
level
value
=
"ALL"
/>
<
appender
-
ref
ref
=
"perfAppender"
/>
</
logger
>
</
log4net
>
\ No newline at end of file
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