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
8b24c0ae
Commit
8b24c0ae
authored
Apr 16, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化 整理机架修正界面。
parent
bc6e1a6e
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
926 additions
and
180 deletions
+926
-180
Colors2.xaml
...FLY.ControlLibrary/FLY.ControlLibrary/Themes/Colors2.xaml
+11
-1
Styles.cs
...ct.FLY.ControlLibrary/FLY.ControlLibrary/Themes/Styles.cs
+11
-13
FLY.Thick.Base.UI.csproj
...FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
+1
-0
PgScanCorr.xaml
...Y.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorr.xaml
+113
-77
PgScanCorr.xaml.cs
...hick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorr.xaml.cs
+3
-2
PgScanCorrVm.cs
...Y.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorrVm.cs
+391
-61
PgScanCorrVmUt.cs
...Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorrVmUt.cs
+332
-0
ScanCorrServiceClient.cs
...Thick.Base/FLY.Thick.Base/Client/ScanCorrServiceClient.cs
+7
-2
IScanCorrService.cs
...LY.Thick.Base/FLY.Thick.Base/IService/IScanCorrService.cs
+7
-1
GM_ScanCorr.cs
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanCorr.cs
+50
-23
No files found.
Project.FLY.ControlLibrary/FLY.ControlLibrary/Themes/Colors2.xaml
View file @
8b24c0ae
...
...
@@ -28,6 +28,16 @@
<SolidColorBrush>#3f51b4</SolidColorBrush>
<SolidColorBrush>#ccdb39</SolidColorBrush>
</x:Array>
<x:Array x:Key="Brushes.Random.Dark" Type="SolidColorBrush">
<SolidColorBrush>#104673</SolidColorBrush>
<SolidColorBrush>#731f19</SolidColorBrush>
<SolidColorBrush>#806104</SolidColorBrush>
<SolidColorBrush>#2d3a40</SolidColorBrush>
<SolidColorBrush>#801137</SolidColorBrush>
<SolidColorBrush>#1c401d</SolidColorBrush>
<SolidColorBrush>#1b224d</SolidColorBrush>
<SolidColorBrush>#474d14</SolidColorBrush>
</x:Array>
<!--扫描图,纵向趋势图Y轴 标签颜色-->
<SolidColorBrush x:Key="Brushes.Area0">#f34336</SolidColorBrush>
...
...
Project.FLY.ControlLibrary/FLY.ControlLibrary/Themes/Styles.cs
View file @
8b24c0ae
...
...
@@ -11,19 +11,22 @@ namespace FLY.ControlLibrary.Themes
public
static
class
Styles
{
static
List
<
SolidColorBrush
>
randomColors
;
static
List
<
SolidColorBrush
>
randomColorsDark
;
public
static
List
<
SolidColorBrush
>
AreaColors
;
static
Styles
()
{
ResourceDictionary
resourceDictionary
=
new
ResourceDictionary
()
{
Source
=
new
Uri
(
"pack://application:,,,/FLY.ControlLibrary;component/Themes/Colors.xaml"
)
};
ResourceDictionary
resourceDictionary
=
new
ResourceDictionary
()
{
Source
=
new
Uri
(
"pack://application:,,,/FLY.ControlLibrary;component/Themes/Colors
2
.xaml"
)
};
AreaColors
=
new
List
<
SolidColorBrush
>();
for
(
int
i
=
0
;
i
<
5
;
i
++)
AreaColors
.
Add
(
resourceDictionary
[
$"
AreaColors
{
i
}
"
]
as
SolidColorBrush
);
AreaColors
.
Add
(
resourceDictionary
[
$"
Brushes.Area
{
i
}
"
]
as
SolidColorBrush
);
randomColors
=
new
List
<
SolidColorBrush
>();
randomColors
.
AddRange
(
resourceDictionary
[
"
RandomColors
"
]
as
IEnumerable
<
SolidColorBrush
>);
randomColors
.
AddRange
(
resourceDictionary
[
"
Brushes.Random
"
]
as
IEnumerable
<
SolidColorBrush
>);
randomColorsDark
=
new
List
<
SolidColorBrush
>();
randomColorsDark
.
AddRange
(
resourceDictionary
[
"Brushes.Random.Dark"
]
as
IEnumerable
<
SolidColorBrush
>);
//randomColors = new SolidColorBrush[] {
// new SolidColorBrush((Color)ColorConverter.ConvertFromString("#2195f2")),
// new SolidColorBrush((Color)ColorConverter.ConvertFromString("#f34336")),
...
...
@@ -49,16 +52,11 @@ namespace FLY.ControlLibrary.Themes
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public
static
Brush
GetForeground
(
int
index
)
public
static
Brush
GetForeground
(
int
index
,
bool
isDark
=
false
)
{
//XamlReader.Loadnew FileStream(@"C:\Users\wppcn\source\repos\网易云\网易云\Resourece\SvgImgResource.xaml", FileMode.Open)) as ResourceDictionary;
//string assembleName = typeof(Styles).Assembly.GetName().Name;//本程序集名
//Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{assembleName}.Themes.Styles.xaml");//获取嵌入资源生成流,XMLPATH为嵌入资源路径,资源名称访问路径为:assemblename.文件夹名.资源名
//XamlReader.Load(stream) as
//IEnumerable<SolidColorBrush> randomColors = App.Current.FindResource("RandomColors") as IEnumerable<SolidColorBrush>;
if
(
isDark
)
return
randomColorsDark
.
ElementAt
(
index
%
randomColorsDark
.
Count
());
else
return
randomColors
.
ElementAt
(
index
%
randomColors
.
Count
());
}
}
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
View file @
8b24c0ae
...
...
@@ -205,6 +205,7 @@
<DependentUpon>
PgPwManager.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"PgScanCorr\PgScanCorrVm.cs"
/>
<Compile
Include=
"PgScanCorr\PgScanCorrVmUt.cs"
/>
<Compile
Include=
"UiModule\DynAreaFilmWidth.xaml.cs"
>
<DependentUpon>
DynAreaFilmWidth.xaml
</DependentUpon>
</Compile>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorr.xaml
View file @
8b24c0ae
...
...
@@ -4,11 +4,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
xmlns:local ="clr-namespace:FLY.Thick.Base.UI" xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
d:DesignHeight="1000" d:DesignWidth="1280"
xmlns:local ="clr-namespace:FLY.Thick.Base.UI"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
d:DesignHeight="1500" d:DesignWidth="1280"
Background="WhiteSmoke"
d:DataContext="{d:DesignInstance local:PgScanCorrVm}"
Title="Page_ScanCorr">
<Page.Resources>
<ResourceDictionary>
...
...
@@ -16,9 +16,10 @@
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Themes/Styles.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:PgScanCorrVmUt x:Key="viewModel" Enable="True"/>
</ResourceDictionary>
</Page.Resources>
<Grid Background="{StaticResource Brushes.Card.Background}" >
<Grid Background="{StaticResource Brushes.Card.Background}"
d:DataContext="{StaticResource viewModel}"
>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
...
...
@@ -41,7 +42,14 @@
<StackPanel>
<TextBlock Style="{StaticResource Styles.Card.Title}"
Text="状态"/>
<StackPanel Orientation="Horizontal">
<StackPanel>
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="使能"/>
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding Enable}"/>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="{StaticResource ControlMargin}">
<TextBlock >
...
...
@@ -59,8 +67,6 @@
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
...
...
@@ -93,7 +99,7 @@
</Button.Style>
</Button>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent}" >
<TextBlock Style="{StaticResource Styles.Text.FieldContent
.Unit
}" >
组<Run Text="{Binding CurrGroupIndex}"/>
</TextBlock>
<Grid Width="100"/>
...
...
@@ -104,11 +110,7 @@
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1"
Orientation="Horizontal">
<Button Style="{StaticResource Styles.Button.Square2}" Content="导出"
Command="{Binding OutXlsxCmd}"/>
</StackPanel>
</Grid>
</StackPanel>
...
...
@@ -117,6 +119,11 @@
<StackPanel>
<TextBlock Style="{StaticResource Styles.Card.Title}"
Text="扫描图"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="组0"
Command="{Binding SelectedGroup0Cmd}">
...
...
@@ -144,9 +151,25 @@
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1">
<Button Content="删除" Style="{StaticResource Styles.Button.Square2}"
Command="{Binding ClearCmd}"/>
</StackPanel>
</Grid>
<ItemsControl ItemsSource="{Binding SeriesInfos}" Margin="5" x:Name="itemSelect">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="平均:"/>
<TextBlock Style="{StaticResource Styles.Text.FieldContent}"
Text="{Binding AvgAd}"/>
</StackPanel>
<ItemsControl Grid.Column="1" ItemsSource="{Binding SeriesInfos}" Margin="{StaticResource ControlMargin}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
...
...
@@ -160,6 +183,9 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
...
...
@@ -222,7 +248,7 @@
Text="修改"/>
<TabControl
Margin="{StaticResource ControlMargin}"
MinHeight="
20
0"
MinHeight="
15
0"
Controls:TabControlHelper.Underlined="TabPanel"
Controls:TabControlHelper.UnderlinePlacement="Bottom"
Controls:HeaderedControlHelper.HeaderFontSize="18">
...
...
@@ -254,10 +280,7 @@
</StackPanel>
</StackPanel>
<StackPanel Grid.Column="1"
Orientation="Horizontal">
<Button Content="应用" Style="{StaticResource Styles.Button.Square2}" Command="{Binding SetCorrDataCmd}"/>
</StackPanel>
</Grid>
</TabItem>
<TabItem Header="关键点方式">
...
...
@@ -283,14 +306,27 @@
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="应用" Style="{StaticResource Styles.Button.Square.Accent2}" Command="{Binding SetCorrDataCmd}"/>
</StackPanel>
<StackPanel Grid.Column="1"
Orientation="Horizontal">
<Button Content="应用" Style="{StaticResource Styles.Button.Square2}" Command="{Binding SetCorrDataCmd}"/>
<Button Style="{StaticResource Styles.Button.Square2}" Content="导出"
Command="{Binding SaveXlsxCmd}"/>
<Button Style="{StaticResource Styles.Button.Square2}" Content="导入"
Command="{Binding LoadXlsxCmd}"/>
</StackPanel>
</Grid>
</TabItem>
</TabControl>
</StackPanel>
</Border>
</StackPanel>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorr.xaml.cs
View file @
8b24c0ae
...
...
@@ -40,11 +40,12 @@ namespace FLY.Thick.Base.UI
[
InjectionMethod
]
public
void
Init
(
IUnityContainer
container
,
IScanCorrService
scanCorrService
,
IInitParamService
initParamService
IInitParamService
initParamService
,
ITDGageService
gageService
)
{
viewModel
=
new
PgScanCorrVm
();
viewModel
.
Init
(
scanCorrService
,
initParamService
);
viewModel
.
Init
(
scanCorrService
,
initParamService
,
gageService
);
this
.
DataContext
=
viewModel
;
container
.
BuildUp
(
mircoGage
);
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorrVm.cs
View file @
8b24c0ae
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgScanCorr/PgScanCorrVmUt.cs
0 → 100644
View file @
8b24c0ae
This diff is collapsed.
Click to expand it.
Project.FLY.Thick.Base/FLY.Thick.Base/Client/ScanCorrServiceClient.cs
View file @
8b24c0ae
...
...
@@ -55,13 +55,18 @@ namespace FLY.Thick.Base.Client
/// </summary>
public
int
ScanCnt
{
get
;
set
;
}
/// <summary>
/// 平滑
/// </summary>
public
int
SmoothFactor
{
get
;
set
;
}
/// <summary>
/// 开始机架修正
/// </summary>
/// <param name="groupIndex">组序号</param>
/// <param name="scanCnt">扫描次数</param>
public
void
Start
(
int
groupIndex
,
int
scanCnt
)
{
Call
(
nameof
(
Start
),
new
{
groupIndex
=
groupIndex
,
scanCnt
=
scanCnt
});
/// <param name="smoothFactor">平滑</param>
public
void
Start
(
int
groupIndex
,
int
scanCnt
,
int
smoothFactor
)
{
Call
(
nameof
(
Start
),
new
{
groupIndex
=
groupIndex
,
scanCnt
=
scanCnt
,
smoothFactor
=
smoothFactor
});
}
/// <summary>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/IService/IScanCorrService.cs
View file @
8b24c0ae
...
...
@@ -42,12 +42,18 @@ namespace FLY.Thick.Base.IService
/// </summary>
int
ScanCnt
{
get
;
}
/// <summary>
/// 平滑
/// </summary>
int
SmoothFactor
{
get
;
}
/// <summary>
/// 开始机架修正
/// </summary>
/// <param name="groupIndex">组序号</param>
/// <param name="scanCnt">扫描次数</param>
void
Start
(
int
groupIndex
,
int
scanCnt
);
/// <param name="smoothFactor">平滑</param>
void
Start
(
int
groupIndex
,
int
scanCnt
,
int
smoothFactor
);
/// <summary>
/// 清空组数据
...
...
Project.FLY.Thick.Base/FLY.Thick.Base/Server/GM_ScanCorr.cs
View file @
8b24c0ae
...
...
@@ -49,7 +49,7 @@ namespace FLY.Thick.Base.Server
/// </summary>
public
int
ScanCnt
{
get
;
set
;
}
=
2
;
public
int
SmoothFactor
{
get
;
set
;
}
=
30
;
#
endregion
...
...
@@ -68,8 +68,28 @@ namespace FLY.Thick.Base.Server
GMState
=
Common
.
CTRL_STATE
.
CORR
;
this
.
file_path
=
param_path
;
Load
();
//参数检测
checkParam
();
this
.
PropertyChanged
+=
GM_ScanCorr_PropertyChanged
;
}
private
void
GM_ScanCorr_PropertyChanged
(
object
sender
,
PropertyChangedEventArgs
e
)
{
if
(
e
.
PropertyName
==
nameof
(
Enable
))
{
Save
();
}
}
void
checkParam
()
{
if
(
Groups
==
null
||
Groups
.
Count
()!=
2
||
Groups
[
0
]==
null
||
Groups
[
1
]
==
null
)
{
Groups
=
new
ScanCorrGroup
[
2
]
{
new
ScanCorrGroup
(),
new
ScanCorrGroup
()
};
}
}
public
void
Init
(
FlyAD7
flyad
,
InitParam
initParam
)
{
base
.
Init
(
flyad
);
...
...
@@ -105,7 +125,7 @@ namespace FLY.Thick.Base.Server
public
void
Start
(
int
groupIndex
,
int
scanCnt
)
public
void
Start
(
int
groupIndex
,
int
scanCnt
,
int
smoothFactor
)
{
if
(
Groups
==
null
||
groupIndex
<
0
||
groupIndex
>=
Groups
.
Count
())
{
...
...
@@ -113,7 +133,7 @@ namespace FLY.Thick.Base.Server
}
Enable
=
false
;
//关闭校正,让flyad7 输出的是原始数据
SmoothFactor
=
smoothFactor
;
ScanCnt
=
scanCnt
;
CurrGroupIndex
=
groupIndex
;
...
...
@@ -146,8 +166,21 @@ namespace FLY.Thick.Base.Server
//顺便把CorrDatas也算出来
//默认以10个数据,平均滤波
group
.
CorrDatas
=
new
int
[
2
][];
group
.
CorrDatas
[
0
]
=
Smooth
(
group
.
OrgDatas
[
0
]);
group
.
CorrDatas
[
1
]
=
Smooth
(
group
.
OrgDatas
[
1
]);
group
.
CorrDatas
[
0
]
=
Smooth
(
group
.
OrgDatas
[
0
],
SmoothFactor
);
group
.
CorrDatas
[
1
]
=
Smooth
(
group
.
OrgDatas
[
1
],
SmoothFactor
);
int
avg0
=
Misc
.
MyMath
.
Avg
(
group
.
CorrDatas
[
0
]);
int
avg1
=
Misc
.
MyMath
.
Avg
(
group
.
CorrDatas
[
1
]);
if
(!
Misc
.
MyBase
.
ISVALIDATA
(
avg0
)
||
!
Misc
.
MyBase
.
ISVALIDATA
(
avg1
))
{
group
.
CorrDatas
=
null
;
group
.
Avg
=
Misc
.
MyBase
.
NULL_VALUE
;
//失败
}
else
{
group
.
Avg
=
(
avg0
+
avg1
)
/
2
;
}
UpdateTimes
[
CurrGroupIndex
]
=
DateTime
.
Now
;
NotifyPropertyChanged
(
nameof
(
UpdateTimes
));
Progress
=
100
;
...
...
@@ -165,7 +198,7 @@ namespace FLY.Thick.Base.Server
Save
();
}
int
[]
Smooth
(
int
[]
orgDatas
,
int
smoothFactor
=
1
0
)
int
[]
Smooth
(
int
[]
orgDatas
,
int
smoothFactor
=
2
0
)
{
var
filters
=
new
int
[
orgDatas
.
Count
()];
...
...
@@ -175,7 +208,7 @@ namespace FLY.Thick.Base.Server
int
cnt
=
0
;
for
(
int
j
=
0
;
j
<
smoothFactor
;
j
++)
{
int
index
=
i
-
smoothFactor
/
2
;
int
index
=
i
-
smoothFactor
/
2
+
j
;
if
(
index
<
0
)
continue
;
else
if
(
index
>=
orgDatas
.
Count
())
...
...
@@ -216,13 +249,14 @@ namespace FLY.Thick.Base.Server
/// <param name="groupIndex"></param>
public
void
Clear
(
int
groupIndex
)
{
if
(
groupIndex
<
0
||
groupIndex
>=
Groups
.
Count
())
{
return
;
Groups
[
groupIndex
].
Clear
();
UpdateTimes
[
groupIndex
]
=
DateTime
.
Now
;
NotifyPropertyChanged
(
nameof
(
UpdateTimes
));
Save
();
}
}
}
private
void
GM_GageInfo_EndEvent
(
object
obj
,
MiniGridEventArgs
e
)
{
DataEnd
(
e
.
direction
,
e
.
posOfGrid
,
e
.
grid_start
,
e
.
buf
);
...
...
@@ -258,7 +292,7 @@ namespace FLY.Thick.Base.Server
orgDatas
[
i
]
=
org_ad
;
}
}
UpdateTimes
[
orgDatas_i
ndex
]
=
DateTime
.
Now
;
UpdateTimes
[
CurrGroupI
ndex
]
=
DateTime
.
Now
;
NotifyPropertyChanged
(
nameof
(
UpdateTimes
));
}
...
...
@@ -288,6 +322,7 @@ namespace FLY.Thick.Base.Server
var
group
=
Groups
[
groupIndex
];
group
.
CorrDatas
=
corrDatas
;
group
.
Avg
=
avg
;
Save
();
}
...
...
@@ -534,17 +569,9 @@ namespace FLY.Thick.Base.Server
}
public
bool
Enable
;
/// <summary>
/// 机架总长,脉冲
/// </summary>
public
int
PosLen
=
9123
;
/// <summary>
/// 1个grid = N个pos
/// </summary>
public
int
PosOfGrid
=
11
;
public
int
ScanCnt
=
2
;
public
int
SmoothFactor
=
30
;
public
ScanCorrGroup
[]
Groups
;
}
...
...
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