Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
Thick-Common
Commits
5fb19414
Commit
5fb19414
authored
Feb 23, 2022
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除没有用的 FlyAd2021.UI 项目
parent
64cbb1ea
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
0 additions
and
995 deletions
+0
-995
App.config
Project.FLY.FlyADBase/FlyAd2021.UI/App.config
+0
-6
App.xaml
Project.FLY.FlyADBase/FlyAd2021.UI/App.xaml
+0
-9
App.xaml.cs
Project.FLY.FlyADBase/FlyAd2021.UI/App.xaml.cs
+0
-17
FlyAd2021.UI.csproj
Project.FLY.FlyADBase/FlyAd2021.UI/FlyAd2021.UI.csproj
+0
-112
HexAndStr.cs
Project.FLY.FlyADBase/FlyAd2021.UI/HexAndStr.cs
+0
-137
MainWindow.xaml
Project.FLY.FlyADBase/FlyAd2021.UI/MainWindow.xaml
+0
-96
MainWindow.xaml.cs
Project.FLY.FlyADBase/FlyAd2021.UI/MainWindow.xaml.cs
+0
-340
AssemblyInfo.cs
...ect.FLY.FlyADBase/FlyAd2021.UI/Properties/AssemblyInfo.cs
+0
-55
Resources.Designer.cs
...Y.FlyADBase/FlyAd2021.UI/Properties/Resources.Designer.cs
+0
-70
Resources.resx
Project.FLY.FlyADBase/FlyAd2021.UI/Properties/Resources.resx
+0
-117
Settings.Designer.cs
...LY.FlyADBase/FlyAd2021.UI/Properties/Settings.Designer.cs
+0
-29
Settings.settings
...t.FLY.FlyADBase/FlyAd2021.UI/Properties/Settings.settings
+0
-7
No files found.
Project.FLY.FlyADBase/FlyAd2021.UI/App.config
deleted
100644 → 0
View file @
64cbb1ea
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6.1"
/>
</
startup
>
</
configuration
>
\ No newline at end of file
Project.FLY.FlyADBase/FlyAd2021.UI/App.xaml
deleted
100644 → 0
View file @
64cbb1ea
<Application x:Class="FlyAd2021.UI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FlyAd2021.UI"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
Project.FLY.FlyADBase/FlyAd2021.UI/App.xaml.cs
deleted
100644 → 0
View file @
64cbb1ea
using
System
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Data
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Windows
;
namespace
FlyAd2021.UI
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public
partial
class
App
:
Application
{
}
}
Project.FLY.FlyADBase/FlyAd2021.UI/FlyAd2021.UI.csproj
deleted
100644 → 0
View file @
64cbb1ea
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"15.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<Import
Project=
"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition=
"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"
/>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProjectGuid>
{E4A61C7C-3282-44C7-9DBA-1AA2F712C10D}
</ProjectGuid>
<OutputType>
WinExe
</OutputType>
<RootNamespace>
FlyAd2021.UI
</RootNamespace>
<AssemblyName>
FlyAd2021.UI
</AssemblyName>
<TargetFrameworkVersion>
v4.6.1
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<ProjectTypeGuids>
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<WarningLevel>
4
</WarningLevel>
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
<Deterministic>
true
</Deterministic>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"Microsoft.CSharp"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xml.Linq"
/>
<Reference
Include=
"System.Data.DataSetExtensions"
/>
<Reference
Include=
"System.Net.Http"
/>
<Reference
Include=
"System.Xaml"
>
<RequiredTargetFramework>
4.0
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"WindowsBase"
/>
<Reference
Include=
"PresentationCore"
/>
<Reference
Include=
"PresentationFramework"
/>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition
Include=
"App.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</ApplicationDefinition>
<Page
Include=
"MainWindow.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Compile
Include=
"App.xaml.cs"
>
<DependentUpon>
App.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"MainWindow.xaml.cs"
>
<DependentUpon>
MainWindow.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Properties\AssemblyInfo.cs"
>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"Properties\Resources.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DesignTime>
True
</DesignTime>
<DependentUpon>
Resources.resx
</DependentUpon>
</Compile>
<Compile
Include=
"Properties\Settings.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DependentUpon>
Settings.settings
</DependentUpon>
<DesignTimeSharedInput>
True
</DesignTimeSharedInput>
</Compile>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<LastGenOutput>
Resources.Designer.cs
</LastGenOutput>
</EmbeddedResource>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"App.config"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\FlyAd2021\FlyAd2021.csproj"
>
<Project>
{9521a8f9-7310-49b3-a951-594efe9d3ef0}
</Project>
<Name>
FlyAd2021
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"MvvmLight"
>
<Version>
5.4.1.1
</Version>
</PackageReference>
<PackageReference
Include=
"PropertyChanged.Fody"
>
<Version>
3.3.1
</Version>
</PackageReference>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
\ No newline at end of file
Project.FLY.FlyADBase/FlyAd2021.UI/HexAndStr.cs
deleted
100644 → 0
View file @
64cbb1ea
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
namespace
Misc
{
public
static
class
HexAndStr
{
public
static
string
Hex2Str2
(
byte
[]
buf
)
{
string
msg
=
""
;
for
(
int
i
=
0
;
i
<
buf
.
Count
();
i
++)
{
if
(!
string
.
IsNullOrEmpty
(
msg
))
msg
+=
" "
;
msg
+=
$"
{
buf
[
i
]:
X2
}
"
;
}
return
msg
;
}
public
static
string
Hex2Str
(
byte
[]
buf
)
{
string
msg
=
""
;
for
(
int
i
=
0
;
i
<
buf
.
Count
();
i
++)
{
if
(!
string
.
IsNullOrEmpty
(
msg
))
msg
+=
" "
;
msg
+=
$"
{
buf
[
i
]:
X2
}
"
;
}
msg
+=
"("
;
for
(
int
i
=
0
;
i
<
buf
.
Count
();
i
++)
{
msg
+=
$"
{(
char
)
buf
[
i
]}
"
;
}
msg
+=
")"
;
return
msg
;
}
static
bool
intTryParse
(
string
value
,
out
int
data
)
{
if
(
value
.
StartsWith
(
"0x"
))
{
if
(!
int
.
TryParse
(
value
,
System
.
Globalization
.
NumberStyles
.
HexNumber
,
null
,
out
data
))
{
return
false
;
}
}
else
if
(!
int
.
TryParse
(
value
,
out
data
))
{
return
false
;
}
return
true
;
}
public
static
bool
Str2Hex
(
string
str
,
out
List
<
byte
>
buf
,
out
string
errMsg
)
{
errMsg
=
null
;
Regex
regex
=
new
Regex
(
@"\\(\S)\((\S+)\)"
);
buf
=
new
List
<
byte
>();
string
[]
ss
=
str
.
Split
(
' '
);
foreach
(
var
s
in
ss
)
{
if
(
s
.
StartsWith
(
@"\"
))
{
//转义
var
match
=
regex
.
Match
(
s
);
if
(!
match
.
Success
)
{
//格式出错
errMsg
=
@"转义格式出错。 应该为 \功能号(数值)"
;
return
false
;
}
string
func
=
match
.
Groups
[
1
].
Value
;
string
value
=
match
.
Groups
[
2
].
Value
;
if
(
new
string
[]
{
"1"
,
"2"
,
"4"
}.
Contains
(
func
))
{
if
(!
intTryParse
(
value
,
out
int
data
))
{
errMsg
=
$@"不支持转义数值无效
{
s
}
"
;
return
false
;
}
if
(
func
==
"1"
)
buf
.
Add
((
byte
)
data
);
else
if
(
func
==
"2"
)
{
byte
[]
hexs
=
BitConverter
.
GetBytes
((
UInt16
)
data
);
buf
.
AddRange
(
hexs
);
}
else
{
byte
[]
hexs
=
BitConverter
.
GetBytes
((
UInt32
)
data
);
buf
.
AddRange
(
hexs
);
}
continue
;
}
else
if
((
func
==
"S"
)
||
(
func
==
"s"
))
{
for
(
int
i
=
0
;
i
<
value
.
Length
;
i
++)
{
byte
hex
=
(
byte
)
value
[
i
];
buf
.
Add
(
hex
);
}
}
else
{
errMsg
=
$@"不支持转义
{
s
}
"
;
return
false
;
}
}
else
{
if
(
byte
.
TryParse
(
s
,
System
.
Globalization
.
NumberStyles
.
HexNumber
,
null
,
out
byte
hex
))
{
buf
.
Add
(
hex
);
continue
;
}
//翻译失败
for
(
int
i
=
0
;
i
<
s
.
Length
;
i
++)
{
hex
=
(
byte
)
s
[
i
];
buf
.
Add
(
hex
);
}
}
}
return
true
;
}
}
}
Project.FLY.FlyADBase/FlyAd2021.UI/MainWindow.xaml
deleted
100644 → 0
View file @
64cbb1ea
<Window x:Class="FlyAd2021.UI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:FlyAd2021.UI"
mc:Ignorable="d"
Title="MainWindow" Width="800" SizeToContent="WidthAndHeight">
<Grid>
<Grid x:Name="grid_viewModel"/>
<Grid x:Name="grid_flyad" DataContext="{Binding FlyAd}"/>
<ScrollViewer>
<StackPanel>
<TextBlock Margin="5" FontSize="25"
Text="V2021版 AD盒 客户端" />
<GroupBox Header="串口 地址=comN OR 网口 地址=192.168.251.10:20006" Margin="5">
<StackPanel DataContext="{Binding DataContext,ElementName=grid_flyad}">
<StackPanel Orientation="Horizontal">
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Text="地址:"/>
<TextBox Text="{Binding Addr}"/>
<TextBlock Text=""/>
</StackPanel>
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext,ElementName=grid_viewModel}">
<Button Content="Start" Command="{Binding StartCmd}" Margin="5" Padding="20,5"/>
<Button Content="Stop" Command="{Binding StopCmd}" Margin="5" Padding="20,5"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock>
IsRunning = <Run Text="{Binding IsRunning,Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Margin="5">
通讯速度 = <Run Text="{Binding CommSpeed,Mode=OneWay,StringFormat={}{0:F1}}"/> B/s
</TextBlock>
<TextBlock Margin="5">
包速度 = <Run Text="{Binding PackSpeed,Mode=OneWay,StringFormat={}{0:F1}}"/> 个/s
</TextBlock>
<TextBlock Margin="5">
包出错次数 = <Run Text="{Binding ErrCnt,Mode=OneWay, StringFormat={}{0:F1}}"/>
</TextBlock>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="数据包" Margin="5">
<StackPanel>
<StackPanel Orientation="Horizontal" Margin="5">
<TextBlock Margin="5">
systick = <Run Text="{Binding Now,Mode=OneWay,StringFormat={}{0:HH:mm:ss}}"/>
</TextBlock>
<TextBlock Margin="5">
AD = <Run Text="{Binding AD,Mode=OneWay}"/>
</TextBlock>
<TextBlock Margin="5">
ENC1 = <Run Text="{Binding ENC1,Mode=OneWay}"/>
</TextBlock>
<TextBlock Margin="5">
ENC2 = <Run Text="{Binding ENC2,Mode=OneWay}"/>
</TextBlock>
<TextBlock Margin="5">
In = <Run Text="{Binding In,Mode=OneWay,StringFormat={}{0:X4}}"/>
</TextBlock>
<TextBlock Margin="5">
Out = <Run Text="{Binding Out,Mode=OneWay,StringFormat={}{0:X4}}"/>
</TextBlock>
<CheckBox Content="数据包Log" IsChecked="{Binding IsDataPackLog}"/>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="功能包" Margin="5">
<StackPanel>
<ListBox x:Name="lbFuncMsg" ItemsSource="{Binding FuncMsgList}" Height="200"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Text="{Binding FuncPack}"/>
<Button Grid.Column="1" Content="发送" Command="{Binding SendFuncPackCmd}" Margin="5" Padding="20,5"/>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</Grid>
</Window>
Project.FLY.FlyADBase/FlyAd2021.UI/MainWindow.xaml.cs
deleted
100644 → 0
View file @
64cbb1ea
using
FlyAd2021.Inc
;
using
GalaSoft.MvvmLight.Command
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
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
System.Windows.Threading
;
namespace
FlyAd2021.UI
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public
partial
class
MainWindow
:
Window
{
FlyAd2021MainVm
viewModel
;
public
MainWindow
()
{
InitializeComponent
();
viewModel
=
new
FlyAd2021MainVm
();
viewModel
.
Init
(
this
,
lbFuncMsg
);
this
.
DataContext
=
viewModel
;
}
}
public
class
FlyAd2021MainVm
:
INotifyPropertyChanged
{
NLog
.
Logger
dataPack_logger
=
NLog
.
LogManager
.
GetLogger
(
"dataPack"
);
NLog
.
Logger
funcPack_logger
=
NLog
.
LogManager
.
GetLogger
(
"funcPack"
);
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
DateTime
Now
{
get
;
set
;
}
public
byte
Tick
{
get
;
set
;
}
public
UInt16
AD
{
get
;
set
;
}
public
UInt16
ENC1
{
get
;
set
;
}
public
UInt16
ENC2
{
get
;
set
;
}
public
UInt16
In
{
get
;
set
;
}
public
UInt16
Out
{
get
;
set
;
}
public
ObservableCollection
<
ReqMsg
>
SendMsgList
{
get
;
}
=
new
ObservableCollection
<
ReqMsg
>();
/// <summary>
/// values容量
/// </summary>
public
int
ValuesCap
{
get
;
set
;
}
=
1000
;
public
bool
IsUpdateValues
{
get
;
set
;
}
public
int
Interval
{
get
;
set
;
}
=
5
;
/// <summary>
/// 数据包,调试记录
/// </summary>
public
bool
IsDataPackLog
{
get
;
set
;
}
public
ObservableCollection
<
string
>
FuncMsgList
{
get
;
}
=
new
ObservableCollection
<
string
>();
public
string
FuncPack
{
get
;
set
;
}
public
RelayCommand
StartCmd
{
get
;
private
set
;
}
public
RelayCommand
StopCmd
{
get
;
private
set
;
}
public
RelayCommand
SendFuncPackCmd
{
get
;
private
set
;
}
public
RelayCommand
SaveSendMsgCmd
{
get
;
private
set
;
}
public
IFlyAd2021Comm
FlyAdComm
=>
comm
;
public
IFlyAd2021Core
FlyAdCore
=>
core
;
IFlyAd2021Core
core
=
new
FlyAd2021Core
();
IFlyAd2021Comm
comm
;
//复制数值到显示
DispatcherTimer
timer
;
DispatcherTimer
timer_timeout
;
DispatcherObject
dispatcherObject
;
ListBox
lbFuncMsg
;
List
<
double
>
values
=
new
List
<
double
>();
List
<
double
>
temps
=
new
List
<
double
>();
public
FlyAd2021MainVm
()
{
StartCmd
=
new
RelayCommand
(
Start
);
StopCmd
=
new
RelayCommand
(
Stop
);
SendFuncPackCmd
=
new
RelayCommand
(
SendFuncPack
);
SaveSendMsgCmd
=
new
RelayCommand
(
SaveSendMsg
);
}
public
void
Init
(
DispatcherObject
dispatcherObject
,
ListBox
lbFuncMsg
)
{
this
.
dispatcherObject
=
dispatcherObject
;
this
.
lbFuncMsg
=
lbFuncMsg
;
core
=
new
FlyAd2021Core
();
core
.
SendMsgEvent
+=
(
s
)
=>
{
byte
[]
msg
=
core
.
GetSendMsg
();
if
(
msg
==
null
)
return
;
comm
?.
SendMsg
(
msg
);
};
core
.
PushDataEvent
+=
Core_PushDataEvent
;
core
.
PushRunResultEvent
+=
Core_PushRunResultEvent
;
core
.
StartMeasure
();
timer
=
new
DispatcherTimer
();
timer
.
Tick
+=
Timer_Tick
;
timer
.
Interval
=
TimeSpan
.
FromSeconds
(
0.1
);
timer_timeout
=
new
DispatcherTimer
();
timer_timeout
.
Tick
+=
Timer_timeout_Tick
;
timer_timeout
.
Interval
=
TimeSpan
.
FromSeconds
(
0.5
);
timer_timeout
.
Start
();
MainJsonDb
.
Load
(
this
,
filePath
);
}
private
void
Timer_timeout_Tick
(
object
sender
,
EventArgs
e
)
{
core
.
OnPoll_TimeOut
();
}
private
void
Core_PushRunResultEvent
(
object
sender
,
PushRunResultEventArgs
e
)
{
throw
new
NotImplementedException
();
}
private
void
Core_PushDataEvent
(
object
sender
,
PushDataEventArgs
_e
)
{
if
(
IsDataPackLog
)
{
string
msg
=
$"数据包
{
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
_e
,
Newtonsoft
.
Json
.
Formatting
.
Indented
)}
"
;
dataPack_logger
.
Debug
(
msg
);
}
dispatcherObject
.
Dispatcher
.
BeginInvoke
(
new
Action
<
PushDataEventArgs
>((
e
)
=>
{
Tick
=
e
.
SysTick
;
AD
=
e
.
AD
;
if
(
e
.
ENC1
!=
null
)
ENC1
=
(
UInt16
)
e
.
ENC1
;
if
(
e
.
ENC2
!=
null
)
ENC2
=
(
UInt16
)
e
.
ENC2
;
if
(
e
.
In
!=
null
)
In
=
(
UInt16
)
e
.
In
;
if
(
e
.
Out
!=
null
)
Out
=
(
UInt16
)
e
.
In
;
}),
_e
);
}
private
void
FlyAd2021_FuncSendPackEvent
(
object
sender
,
PackEventArgs
e
)
{
{
string
msg
=
$"功能包 PC->AD盒
{
Misc
.
HexAndStr
.
Hex2Str
(
e
.
Pack
)}
"
;
funcPack_logger
.
Debug
(
msg
);
}
dispatcherObject
.
Dispatcher
.
Invoke
(()
=>
{
string
msg
=
$"
{
e
.
Time
}
PC->AD盒
{
Misc
.
HexAndStr
.
Hex2Str
(
e
.
Pack
)}
"
;
FuncMsgList
.
Add
(
msg
);
if
(
FuncMsgList
.
Count
>
20
)
FuncMsgList
.
RemoveAt
(
0
);
lbFuncMsg
.
ScrollIntoView
(
msg
);
});
}
private
void
FlyAd2021_FuncRecPackEvent
(
object
sender
,
PackEventArgs
e
)
{
{
string
msg
=
$"功能包 AD盒->PC
{
Misc
.
HexAndStr
.
Hex2Str
(
e
.
Pack
)}
"
;
funcPack_logger
.
Debug
(
msg
);
}
dispatcherObject
.
Dispatcher
.
Invoke
(()
=>
{
string
msg
=
$"
{
e
.
Time
}
AD盒->PC
{
Misc
.
HexAndStr
.
Hex2Str
(
e
.
Pack
)}
"
;
FuncMsgList
.
Add
(
msg
);
if
(
FuncMsgList
.
Count
>
20
)
FuncMsgList
.
RemoveAt
(
0
);
lbFuncMsg
.
ScrollIntoView
(
msg
);
});
}
private
void
FlyAd2021_RecPackEvent
(
object
sender
,
PackEventArgs
e
)
{
//0.1刷新一次
}
bool
GetAvg
(
UInt16
ad
,
out
double
avg
)
{
temps
.
Add
(
ad
);
if
(
temps
.
Count
()
>=
Interval
)
{
avg
=
temps
.
Average
(
t
=>
(
double
)
t
);
temps
.
Clear
();
return
true
;
}
avg
=
0
;
return
false
;
}
private
void
FlyAd2021_TimeGridEvent
(
object
sender
,
TimeGridEventArgs
e
)
{
for
(
int
i
=
0
;
i
<
e
.
ADs
.
Count
();
i
++)
{
UInt16
ad
=
e
.
ADs
[
i
];
if
(
GetAvg
(
ad
,
out
double
avg
))
{
values
.
Add
(
avg
);
}
}
int
remove_cnt
=
values
.
Count
()
-
ValuesCap
;
if
(
remove_cnt
>
0
)
{
values
.
RemoveRange
(
0
,
remove_cnt
);
}
if
(
IsUpdateValues
)
{
Values
.
Clear
();
Values
.
AddRange
(
values
);
}
}
private
void
Timer_Tick
(
object
sender
,
EventArgs
e
)
{
Now
=
flyAd2021
.
Now
;
AD
=
flyAd2021
.
AD
;
ENC1
=
flyAd2021
.
ENC1
;
ENC2
=
flyAd2021
.
ENC2
;
In
=
flyAd2021
.
In
;
Out
=
flyAd2021
.
Out
;
}
private
void
Stop
()
{
timer
.
Stop
();
flyAd2021
.
Stop
();
}
private
void
Start
()
{
temps
.
Clear
();
timer
.
Start
();
flyAd2021
.
Start
();
}
private
void
SendFuncPack
()
{
if
(
string
.
IsNullOrEmpty
(
FuncPack
))
{
MessageBox
.
Show
(
"没有任何数据"
);
return
;
}
//翻译
if
(!
Misc
.
HexAndStr
.
Str2Hex
(
FuncPack
,
out
List
<
byte
>
buf
,
out
string
errMsg
))
{
MessageBox
.
Show
(
errMsg
);
return
;
}
flyAd2021
.
Send
(
buf
);
MessageBox
.
Show
(
"发送完成"
);
}
string
filePath
=
"wdmain.json"
;
private
void
SaveSendMsg
()
{
if
(
string
.
IsNullOrEmpty
(
FuncPack
))
{
MessageBox
.
Show
(
"没有任何数据"
);
return
;
}
//输入描述
MainJsonDb
.
Save
(
this
,
filePath
);
}
}
public
class
ReqMsg
:
INotifyPropertyChanged
{
public
string
Msg
{
get
;
set
;
}
public
string
Description
{
get
;
set
;
}
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
public
class
MainJsonDb
{
public
List
<
ReqMsg
>
ReqMsgs
;
public
static
bool
Save
(
FlyAd2021MainVm
src
,
string
filePath
)
{
MainJsonDb
jsonDb
=
new
MainJsonDb
();
jsonDb
.
ReqMsgs
=
src
.
SendMsgList
.
ToList
();
string
json
=
Newtonsoft
.
Json
.
JsonConvert
.
SerializeObject
(
jsonDb
,
Newtonsoft
.
Json
.
Formatting
.
Indented
);
File
.
WriteAllText
(
filePath
,
json
);
return
true
;
}
public
static
bool
Load
(
FlyAd2021MainVm
src
,
string
filePath
)
{
if
(!
File
.
Exists
(
filePath
))
return
false
;
string
json
=
File
.
ReadAllText
(
filePath
);
try
{
var
jsonDb
=
Newtonsoft
.
Json
.
JsonConvert
.
DeserializeObject
<
MainJsonDb
>(
json
);
src
.
SendMsgList
.
Clear
();
foreach
(
var
r
in
jsonDb
.
ReqMsgs
)
src
.
SendMsgList
.
Add
(
r
);
return
true
;
}
catch
{
return
false
;
}
}
}
}
Project.FLY.FlyADBase/FlyAd2021.UI/Properties/AssemblyInfo.cs
deleted
100644 → 0
View file @
64cbb1ea
using
System.Reflection
;
using
System.Resources
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Windows
;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("FlyAd2021.UI")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FlyAd2021.UI")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
//若要开始生成可本地化的应用程序,请设置
//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
//例如,如果您在源文件中使用的是美国英语,
//使用的是美国英语,请将 <UICulture> 设置为 en-US。 然后取消
//对以下 NeutralResourceLanguage 特性的注释。 更新
//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[
assembly
:
ThemeInfo
(
ResourceDictionaryLocation
.
None
,
//主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation
.
SourceAssembly
//常规资源词典所处位置
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
)]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Project.FLY.FlyADBase/FlyAd2021.UI/Properties/Resources.Designer.cs
deleted
100644 → 0
View file @
64cbb1ea
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace
FlyAd2021.UI.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"4.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
private
static
global
::
System
.
Resources
.
ResourceManager
resourceMan
;
private
static
global
::
System
.
Globalization
.
CultureInfo
resourceCulture
;
[
global
::
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessageAttribute
(
"Microsoft.Performance"
,
"CA1811:AvoidUncalledPrivateCode"
)]
internal
Resources
()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
get
{
if
((
resourceMan
==
null
))
{
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"FlyAd2021.UI.Properties.Resources"
,
typeof
(
Resources
).
Assembly
);
resourceMan
=
temp
;
}
return
resourceMan
;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Globalization
.
CultureInfo
Culture
{
get
{
return
resourceCulture
;
}
set
{
resourceCulture
=
value
;
}
}
}
}
Project.FLY.FlyADBase/FlyAd2021.UI/Properties/Resources.resx
deleted
100644 → 0
View file @
64cbb1ea
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
</root>
\ No newline at end of file
Project.FLY.FlyADBase/FlyAd2021.UI/Properties/Settings.Designer.cs
deleted
100644 → 0
View file @
64cbb1ea
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace
FlyAd2021.UI.Properties
{
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"11.0.0.0"
)]
internal
sealed
partial
class
Settings
:
global
::
System
.
Configuration
.
ApplicationSettingsBase
{
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
public
static
Settings
Default
{
get
{
return
defaultInstance
;
}
}
}
}
Project.FLY.FlyADBase/FlyAd2021.UI/Properties/Settings.settings
deleted
100644 → 0
View file @
64cbb1ea
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile
xmlns=
"uri:settings"
CurrentProfile=
"(Default)"
>
<Profiles>
<Profile
Name=
"(Default)"
/>
</Profiles>
<Settings
/>
</SettingsFile>
\ 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