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
2dc0c6ce
Commit
2dc0c6ce
authored
Jul 09, 2021
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加 报警服务管理器 默认全部报警服务注册,但可以通过 配置设置某些报警服务不注册
parent
c21b43d0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
219 additions
and
8 deletions
+219
-8
WarningSystem2ServiceClientWithName.cs
...k.Base.UI/DependOn/WarningSystem2ServiceClientWithName.cs
+0
-1
FLY.Thick.Base.UI.csproj
...FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
+7
-0
OnInitWarnings.cs
...FLY.Thick.Base/FLY.Thick.Base.UI/OnInit/OnInitWarnings.cs
+85
-5
ParamDistItemKeys.cs
...ect.FLY.Thick.Base/FLY.Thick.Base.UI/ParamDistItemKeys.cs
+1
-1
PgErrorsTable.xaml
...Y.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorsTable.xaml
+3
-1
PgErrorsTable.xaml.cs
...hick.Base/FLY.Thick.Base.UI/PgError/PgErrorsTable.xaml.cs
+8
-0
WdWarningUnityNames.xaml
...k.Base/FLY.Thick.Base.UI/PgError/WdWarningUnityNames.xaml
+35
-0
WdWarningUnityNames.xaml.cs
...ase/FLY.Thick.Base.UI/PgError/WdWarningUnityNames.xaml.cs
+80
-0
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/DependOn/WarningSystem2ServiceClientWithName.cs
View file @
2dc0c6ce
...
@@ -19,7 +19,6 @@ namespace FLY.Thick.Base.UI
...
@@ -19,7 +19,6 @@ namespace FLY.Thick.Base.UI
public
WarningSystem2ServiceClientWithName
(
UInt32
serviceId
,
string
connName
,
string
devName
)
:
base
(
serviceId
,
connName
)
public
WarningSystem2ServiceClientWithName
(
UInt32
serviceId
,
string
connName
,
string
devName
)
:
base
(
serviceId
,
connName
)
{
{
DevName
=
devName
;
DevName
=
devName
;
}
}
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/FLY.Thick.Base.UI.csproj
View file @
2dc0c6ce
...
@@ -172,6 +172,9 @@
...
@@ -172,6 +172,9 @@
<Compile
Include=
"PgError\PgErrorTable2.xaml.cs"
>
<Compile
Include=
"PgError\PgErrorTable2.xaml.cs"
>
<DependentUpon>
PgErrorTable2.xaml
</DependentUpon>
<DependentUpon>
PgErrorTable2.xaml
</DependentUpon>
</Compile>
</Compile>
<Compile
Include=
"PgError\WdWarningUnityNames.xaml.cs"
>
<DependentUpon>
WdWarningUnityNames.xaml
</DependentUpon>
</Compile>
<Compile
Include=
"PgFlyAd.xaml.cs"
>
<Compile
Include=
"PgFlyAd.xaml.cs"
>
<DependentUpon>
PgFlyAd.xaml
</DependentUpon>
<DependentUpon>
PgFlyAd.xaml
</DependentUpon>
</Compile>
</Compile>
...
@@ -341,6 +344,10 @@
...
@@ -341,6 +344,10 @@
<Generator>
MSBuild:Compile
</Generator>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
<SubType>
Designer
</SubType>
</Page>
</Page>
<Page
Include=
"PgError\WdWarningUnityNames.xaml"
>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
</Page>
<Page
Include=
"PgFlyAd.xaml"
>
<Page
Include=
"PgFlyAd.xaml"
>
<SubType>
Designer
</SubType>
<SubType>
Designer
</SubType>
<Generator>
MSBuild:Compile
</Generator>
<Generator>
MSBuild:Compile
</Generator>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/OnInit/OnInitWarnings.cs
View file @
2dc0c6ce
...
@@ -107,17 +107,48 @@ namespace FLY.Thick.Base.UI.OnInit
...
@@ -107,17 +107,48 @@ namespace FLY.Thick.Base.UI.OnInit
public
List
<
ErrorWithName
>
Errors
{
get
;
private
set
;
}
=
new
List
<
ErrorWithName
>();
public
List
<
ErrorWithName
>
Errors
{
get
;
private
set
;
}
=
new
List
<
ErrorWithName
>();
public
bool
IsRinging
{
get
;
set
;
}
public
bool
IsRinging
{
get
;
set
;
}
/// <summary>
/// 报警服务容器
/// </summary>
IUnityContainer
warning_container
;
ParamDictionary
paramDictionary
;
[
InjectionMethod
]
[
InjectionMethod
]
public
void
Init
(
IUnityContainer
container
)
public
void
Init
(
IUnityContainer
container
,
ParamDictionary
paramDictionary
)
{
{
//找到 warnings.service 容器
//找到 warnings.service 容器
if
(!
container
.
IsRegistered
<
IUnityContainer
>(
"warnings.service"
))
if
(!
container
.
IsRegistered
<
IUnityContainer
>(
"warnings.service"
))
return
;
return
;
this
.
warning_container
=
container
.
Resolve
<
IUnityContainer
>(
"warnings.service"
);
this
.
paramDictionary
=
paramDictionary
;
//不需要关注的 报警服务,不需要 resolve
//获取 不需要关注 的报警服务 在容器中的名字
var
skipWarningUnityNames
=
paramDictionary
.
GetValue
<
List
<
string
>>(
ParamDistItemKeys
.
SkipWarningUnityNames
,
null
);
if
(
skipWarningUnityNames
==
null
||
skipWarningUnityNames
.
Count
()
==
0
)
{
//全部获取
Warnings
.
AddRange
(
warning_container
.
ResolveAll
<
WarningSystem2ServiceClientWithName
>());
}
else
{
Warnings
=
new
List
<
WarningSystem2ServiceClientWithName
>();
foreach
(
var
registration
in
warning_container
.
Registrations
)
{
if
(
registration
.
RegisteredType
==
typeof
(
WarningSystem2ServiceClientWithName
))
{
if
(!
skipWarningUnityNames
.
Contains
(
registration
.
Name
))
{
//没有被 忽略
var
warning
=
warning_container
.
Resolve
<
WarningSystem2ServiceClientWithName
>(
registration
.
Name
);
Warnings
.
Add
(
warning
);
}
}
}
}
var
warning_container
=
container
.
Resolve
<
IUnityContainer
>(
"warnings.service"
);
//获取全部报警管理器
Warnings
=
warning_container
.
ResolveAll
<
WarningSystem2ServiceClientWithName
>().
ToList
();
IsRinging
=
Warnings
.
Any
(
w
=>
w
.
IsRinging
);
IsRinging
=
Warnings
.
Any
(
w
=>
w
.
IsRinging
);
foreach
(
var
warning
in
Warnings
)
foreach
(
var
warning
in
Warnings
)
...
@@ -175,7 +206,56 @@ namespace FLY.Thick.Base.UI.OnInit
...
@@ -175,7 +206,56 @@ namespace FLY.Thick.Base.UI.OnInit
else
{
else
{
Errors
=
new
List
<
ErrorWithName
>();
Errors
=
new
List
<
ErrorWithName
>();
}
}
}
}
/// <summary>
/// 返回 报警服务名字
/// </summary>
/// <returns></returns>
public
List
<
WarningName
>
GetWarningNames
()
{
List
<
WarningName
>
warningNames
=
new
List
<
WarningName
>();
foreach
(
var
registration
in
warning_container
.
Registrations
)
{
if
(
registration
.
RegisteredType
==
typeof
(
WarningSystem2ServiceClientWithName
))
{
//没有被 忽略
//var warning = warning_container.Resolve<WarningSystem2ServiceClientWithName>(registration.Name);
warningNames
.
Add
(
new
WarningName
()
{
//DevName = warning.DevName,
UnityName
=
registration
.
Name
});
}
}
var
skipWarningUnityNames
=
paramDictionary
.
GetValue
<
List
<
string
>>(
ParamDistItemKeys
.
SkipWarningUnityNames
,
null
);
if
(
skipWarningUnityNames
!=
null
&&
skipWarningUnityNames
.
Count
()
>
0
)
{
foreach
(
var
unityName
in
skipWarningUnityNames
)
{
var
wn
=
warningNames
.
Find
(
w
=>
w
.
UnityName
==
unityName
);
if
(
wn
!=
null
)
wn
.
IsRegistered
=
false
;
}
}
return
warningNames
;
}
public
void
SetSkipWarningName
(
List
<
string
>
unityNames
)
{
paramDictionary
.
SetValue
(
ParamDistItemKeys
.
SkipWarningUnityNames
,
unityNames
);
}
}
public
class
WarningName
:
INotifyPropertyChanged
{
/// <summary>
/// 设备名称
/// </summary>
//public string DevName { get; set; }
public
string
UnityName
{
get
;
set
;
}
public
bool
IsRegistered
{
get
;
set
;
}
=
true
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
}
}
public
class
ErrorWithName
:
INotifyPropertyChanged
public
class
ErrorWithName
:
INotifyPropertyChanged
{
{
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/ParamDistItemKeys.cs
View file @
2dc0c6ce
...
@@ -17,6 +17,6 @@ namespace FLY.Thick.Base.UI
...
@@ -17,6 +17,6 @@ namespace FLY.Thick.Base.UI
public
const
string
LCUS1_PortName
=
"LCUS1_PortName"
;
public
const
string
LCUS1_PortName
=
"LCUS1_PortName"
;
public
const
string
LCUS1_Enable
=
"LCUS1_Enable"
;
public
const
string
LCUS1_Enable
=
"LCUS1_Enable"
;
public
const
string
WindowSize
=
"WindowSize"
;
public
const
string
WindowSize
=
"WindowSize"
;
public
const
string
SkipWarningUnityNames
=
"SkipWarningUnityNames"
;
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorsTable.xaml
View file @
2dc0c6ce
...
@@ -80,7 +80,9 @@
...
@@ -80,7 +80,9 @@
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Grid.Column="1" Style="{StaticResource Styles.Button.Icon.Rectangle}" VerticalAlignment="Bottom" Click="btnSetupClick">
<iconPacks:PackIconMaterial Kind="Menu" />
</Button>
</Grid>
</Grid>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/PgErrorsTable.xaml.cs
View file @
2dc0c6ce
...
@@ -76,5 +76,13 @@ namespace FLY.Thick.Base.UI
...
@@ -76,5 +76,13 @@ namespace FLY.Thick.Base.UI
new
Unity
.
Resolution
.
ParameterOverride
(
"warning"
,
warning
));
new
Unity
.
Resolution
.
ParameterOverride
(
"warning"
,
warning
));
NavigationService
.
Navigate
(
p
);
NavigationService
.
Navigate
(
p
);
}
}
private
void
btnSetupClick
(
object
sender
,
RoutedEventArgs
e
)
{
WdWarningUnityNames
w
=
new
WdWarningUnityNames
();
w
.
Init
(
warningSystemManager
);
w
.
Owner
=
App
.
Current
.
MainWindow
;
w
.
ShowDialog
();
}
}
}
}
}
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdWarningUnityNames.xaml
0 → 100644
View file @
2dc0c6ce
<flyctrllib:WindowBigClose x:Class="FLY.Thick.Base.UI.WdWarningUnityNames"
xmlns:flyctrllib="clr-namespace:FLY.ControlLibrary;assembly=FLY.ControlLibrary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FLY.Thick.Base.UI"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
WindowStartupLocation="CenterScreen" SizeToContent="WidthAndHeight">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<local:WdWarningUnityNamesVmUt x:Key="viewModel"/>
</ResourceDictionary>
</Window.Resources>
<StackPanel Margin="5,20" d:DataContext="{StaticResource viewModel}">
<TextBlock Style="{StaticResource Styles.Card.Title2}" Text="报警服务列表" />
<ListBox ItemsSource="{Binding WarningNames}" Margin="{StaticResource ControlMargin}" MinWidth="400" Height="400" Grid.Row="1" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
<ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsRegistered}"/>
<TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="{Binding UnityName}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Style="{StaticResource Styles.Button.Apply}" Grid.Row="2"
Command="{Binding OkCmd}" />
</StackPanel>
</flyctrllib:WindowBigClose >
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdWarningUnityNames.xaml.cs
0 → 100644
View file @
2dc0c6ce
using
FLY.Thick.Base.UI.OnInit
;
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.Shapes
;
namespace
FLY.Thick.Base.UI
{
/// <summary>
/// WdSkipWarningUnityNames.xaml 的交互逻辑
/// </summary>
public
partial
class
WdWarningUnityNames
:
FLY
.
ControlLibrary
.
WindowBigClose
{
WdWarningUnityNamesVm
viewModel
;
public
WdWarningUnityNames
()
{
InitializeComponent
();
}
public
void
Init
(
WarningSystemManager
warningSystemManager
)
{
viewModel
=
new
WdWarningUnityNamesVm
();
viewModel
.
Init
(
warningSystemManager
);
this
.
DataContext
=
viewModel
;
}
}
public
class
WdWarningUnityNamesVm
:
INotifyPropertyChanged
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
ObservableCollection
<
WarningName
>
WarningNames
{
get
;
}
=
new
ObservableCollection
<
WarningName
>();
public
RelayCommand
OkCmd
{
get
;
private
set
;
}
WarningSystemManager
warningSystemManager
;
public
WdWarningUnityNamesVm
()
{
OkCmd
=
new
RelayCommand
(
Ok
);
}
public
void
Init
(
WarningSystemManager
warningSystemManager
)
{
this
.
warningSystemManager
=
warningSystemManager
;
var
names
=
warningSystemManager
.
GetWarningNames
();
foreach
(
var
name
in
names
)
WarningNames
.
Add
(
name
);
}
private
void
Ok
()
{
var
skips
=
WarningNames
.
Where
(
w
=>
!
w
.
IsRegistered
).
Select
(
w
=>
w
.
UnityName
).
ToList
();
warningSystemManager
.
SetSkipWarningName
(
skips
);
FLY
.
ControlLibrary
.
Window_Tip
.
Show
(
"成功"
,
$"
{
WarningNames
.
Count
()
-
skips
.
Count
()}
个报警服务 需要注册关注"
);
}
}
public
class
WdWarningUnityNamesVmUt
:
WdWarningUnityNamesVm
{
public
WdWarningUnityNamesVmUt
()
{
WarningNames
.
Add
(
new
WarningName
()
{
UnityName
=
"测厚仪"
});
WarningNames
.
Add
(
new
WarningName
()
{
UnityName
=
"风环"
});
WarningNames
.
Add
(
new
WarningName
()
{
UnityName
=
"称重"
,
IsRegistered
=
false
});
}
}
}
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