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
ed7bf665
Commit
ed7bf665
authored
Sep 17, 2023
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 Base.UI 的 Styles.xaml, 删除每个界面文件都加载一次 Styles.xaml. 写在了App.xaml 统一处理
parent
afe8521c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
132 additions
and
63 deletions
+132
-63
App.xaml
Project.FLY.Thick.Base/FLY.Thick.Base.UI/App.xaml
+5
-0
Dictionary_MyConv.xaml
...k.Base/FLY.Thick.Base.UI/Converter/Dictionary_MyConv.xaml
+4
-0
WdIOTip.xaml
...ect.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdIOTip.xaml
+0
-4
WdIOTip.xaml.cs
....FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdIOTip.xaml.cs
+83
-52
GraphStyle.xaml
...t.FLY.Thick.Base/FLY.Thick.Base.UI/Themes/GraphStyle.xaml
+39
-0
Styles.xaml
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Themes/Styles.xaml
+1
-7
No files found.
Project.FLY.Thick.Base/FLY.Thick.Base.UI/App.xaml
View file @
ed7bf665
...
@@ -8,6 +8,11 @@
...
@@ -8,6 +8,11 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
<ResourceDictionary Source="Themes/Styles.xaml"/>
<ResourceDictionary Source="Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="GroupBox" />
<Style TargetType="GroupBox" />
</ResourceDictionary>
</ResourceDictionary>
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Converter/Dictionary_MyConv.xaml
View file @
ed7bf665
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:conv="clr-namespace:FLY.Thick.Base.UI.Converter"
xmlns:conv="clr-namespace:FLY.Thick.Base.UI.Converter"
>
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
</ResourceDictionary.MergedDictionaries>
<conv:ThickConverter x:Key="thickconv" />
<conv:ThickConverter x:Key="thickconv" />
<conv:IntConverter x:Key="intconv" />
<conv:IntConverter x:Key="intconv" />
<conv:DoubleConverter x:Key="doubleconv" />
<conv:DoubleConverter x:Key="doubleconv" />
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdIOTip.xaml
View file @
ed7bf665
...
@@ -9,10 +9,6 @@
...
@@ -9,10 +9,6 @@
Title="AD盒IO口定义" Height="537" Width="484" >
Title="AD盒IO口定义" Height="537" Width="484" >
<Window.Resources>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style x:Key="IOStyle" TargetType="Rectangle" >
<Style x:Key="IOStyle" TargetType="Rectangle" >
<Setter Property="Width" Value="10" />
<Setter Property="Width" Value="10" />
<Setter Property="Height" Value="20" />
<Setter Property="Height" Value="20" />
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/PgError/WdIOTip.xaml.cs
View file @
ed7bf665
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.Common
;
using
FLY.Thick.Base.IService
;
using
FLY.Thick.Base.IService
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.ComponentModel
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
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
;
using
Unity
;
using
Unity
;
namespace
FLY.Thick.Base.UI
namespace
FLY.Thick.Base.UI
...
@@ -21,17 +11,24 @@ namespace FLY.Thick.Base.UI
...
@@ -21,17 +11,24 @@ namespace FLY.Thick.Base.UI
/// <summary>
/// <summary>
/// WdIOTip.xaml 的交互逻辑
/// WdIOTip.xaml 的交互逻辑
/// </summary>
/// </summary>
public
partial
class
WdIOTip
:
FLY
.
ControlLibrary
.
WindowBigClose
public
partial
class
WdIOTip
:
FLY
.
ControlLibrary
.
WindowBigClose
{
{
WdIoTipVm
viewModel
;
WdIoTipVm
viewModel
;
public
WdIOTip
()
public
WdIOTip
()
{
{
InitializeComponent
();
InitializeComponent
();
this
.
Unloaded
+=
WdIOTip_Unloaded
;
}
}
private
void
WdIOTip_Unloaded
(
object
sender
,
System
.
Windows
.
RoutedEventArgs
e
)
{
viewModel
.
DisposeBinding
();
}
[
InjectionMethod
]
[
InjectionMethod
]
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
ITDGageService
gageService
)
{
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
ITDGageService
gageService
)
{
viewModel
=
new
WdIoTipVm
();
viewModel
=
new
WdIoTipVm
();
viewModel
.
Init
(
iODefineService
,
gageService
.
DynArea
);
viewModel
.
Init
(
iODefineService
,
gageService
.
DynArea
);
...
@@ -44,55 +41,87 @@ namespace FLY.Thick.Base.UI
...
@@ -44,55 +41,87 @@ namespace FLY.Thick.Base.UI
{
{
public
event
PropertyChangedEventHandler
PropertyChanged
;
public
event
PropertyChangedEventHandler
PropertyChanged
;
IFlyAdIoDefineService
iODefineService
;
Base
.
Common
.
DynArea
dynArea
;
public
ObservableCollection
<
FlyAdIoStatus
>
IStatus
{
get
;
}
=
new
ObservableCollection
<
FlyAdIoStatus
>();
public
ObservableCollection
<
FlyAdIoStatus
>
IStatus
{
get
;
}
=
new
ObservableCollection
<
FlyAdIoStatus
>();
public
ObservableCollection
<
FlyAdIoStatus
>
OStatus
{
get
;
}
=
new
ObservableCollection
<
FlyAdIoStatus
>();
public
ObservableCollection
<
FlyAdIoStatus
>
OStatus
{
get
;
}
=
new
ObservableCollection
<
FlyAdIoStatus
>();
public
WdIoTipVm
()
{
IFlyAdIoDefineService
iODefineService
;
}
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
DynArea
dynArea
)
DynArea
dynArea
;
{
this
.
dynArea
=
dynArea
;
this
.
iODefineService
=
iODefineService
;
for
(
int
i
=
0
;
i
<
12
;
i
++)
{
Dictionary
<
object
,
List
<
Misc
.
BindingOperations
.
PropertyChangedEventContexts
>>
bindingConexts
=
new
Dictionary
<
object
,
List
<
Misc
.
BindingOperations
.
PropertyChangedEventContexts
>>();
/// <summary>
/// 数据已经绑定了
/// </summary>
bool
isBinding
;
public
WdIoTipVm
()
{
for
(
int
i
=
0
;
i
<
12
;
i
++)
{
IStatus
.
Add
(
new
FlyAdIoStatus
()
IStatus
.
Add
(
new
FlyAdIoStatus
()
{
{
Number
=
$"i
{
i
+
1
}
"
Number
=
$"i
{
i
+
1
}
"
});
});
};
};
for
(
int
i
=
0
;
i
<
4
;
i
++)
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
{
OStatus
.
Add
(
new
FlyAdIoStatus
()
OStatus
.
Add
(
new
FlyAdIoStatus
()
{
{
Number
=
$"o
{
i
+
1
}
"
Number
=
$"o
{
i
+
1
}
"
});
});
};
};
}
if
(
this
.
iODefineService
is
FObjBase
.
FObjServiceClient
)
public
void
Init
(
IFlyAdIoDefineService
iODefineService
,
DynArea
dynArea
)
{
{
var
client
=
this
.
iODefineService
as
FObjBase
.
FObjServiceClient
;
this
.
dynArea
=
dynArea
;
if
(
client
.
IsConnected
)
this
.
iODefineService
=
iODefineService
;
{
update
();
SetBinding
();
}
}
client
.
PropertyChanged
+=
Client_PropertyChanged
;
/// <summary>
}
/// 参数绑定
else
/// </summary>
public
void
SetBinding
()
{
if
(
isBinding
)
//已经绑定了
return
;
isBinding
=
true
;
//下面全部event保存在bindingConexts
Misc
.
BindingOperations
.
StartMarkdownEvents
(
bindingConexts
);
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
IStatus
),
this
,
updateIsOn_In
);
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
OStatus
),
this
,
updateIsOn_Out
);
//备份event完毕, 必须关闭记录
Misc
.
BindingOperations
.
StopMarkdownEvents
();
var
client
=
this
.
iODefineService
as
FObjBase
.
FObjServiceClient
;
if
(
client
.
IsConnected
)
{
{
update
();
update
();
}
}
client
.
PropertyChanged
+=
Client_PropertyChanged
;
}
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
IStatus
),
updateIsOn_In
);
/// <summary>
Misc
.
BindingOperations
.
SetBinding
(
dynArea
,
nameof
(
dynArea
.
OStatus
),
updateIsOn_Out
);
/// 解除绑定
/// </summary>
public
void
DisposeBinding
()
{
if
(!
isBinding
)
//已经解除绑定了
return
;
isBinding
=
false
;
Misc
.
BindingOperations
.
DisposeEventTargetObject
(
bindingConexts
);
var
client
=
this
.
iODefineService
as
FObjBase
.
FObjServiceClient
;
client
.
PropertyChanged
-=
Client_PropertyChanged
;
}
}
void
updateIsOn_In
()
void
updateIsOn_In
()
{
{
for
(
int
i
=
0
;
i
<
IStatus
.
Count
();
i
++)
for
(
int
i
=
0
;
i
<
IStatus
.
Count
();
i
++)
{
{
...
@@ -120,10 +149,12 @@ namespace FLY.Thick.Base.UI
...
@@ -120,10 +149,12 @@ namespace FLY.Thick.Base.UI
void
update
()
void
update
()
{
{
iODefineService
.
GetIODefine
((
asyncContext
,
retData
)
=>
{
iODefineService
.
GetIODefine
((
asyncContext
,
retData
)
=>
{
var
reponse
=
retData
as
IODefineCollection
;
var
reponse
=
retData
as
IODefineCollection
;
if
(
reponse
==
null
)
{
if
(
reponse
==
null
)
{
return
;
return
;
}
}
var
list
=
reponse
.
List
;
var
list
=
reponse
.
List
;
...
@@ -142,7 +173,7 @@ namespace FLY.Thick.Base.UI
...
@@ -142,7 +173,7 @@ namespace FLY.Thick.Base.UI
IODefine
.
IOTYPE
ioType
,
IODefine
.
IOTYPE
ioType
,
ObservableCollection
<
FlyAdIoStatus
>
ioStatus
,
ObservableCollection
<
FlyAdIoStatus
>
ioStatus
,
int
ioCnt
,
int
ioCnt
,
List
<
IODefine
>
list
)
List
<
IODefine
>
list
)
{
{
//补够数量
//补够数量
if
(
ioStatus
.
Count
()
!=
ioCnt
&&
ioCnt
>
0
)
if
(
ioStatus
.
Count
()
!=
ioCnt
&&
ioCnt
>
0
)
...
@@ -231,21 +262,21 @@ namespace FLY.Thick.Base.UI
...
@@ -231,21 +262,21 @@ namespace FLY.Thick.Base.UI
});
});
};
};
IStatus
[
2
-
1
].
IsOn
=
true
;
IStatus
[
1
].
IsOn
=
true
;
IStatus
[
4
-
1
].
IsOn
=
true
;
IStatus
[
3
].
IsOn
=
true
;
IStatus
[
1
1
-
1
].
IsOn
=
true
;
IStatus
[
1
0
].
IsOn
=
true
;
OStatus
[
4
-
1
].
IsOn
=
true
;
OStatus
[
3
].
IsOn
=
true
;
IStatus
[
2
-
1
].
Desp
=
"归零信号"
;
IStatus
[
1
].
Desp
=
"归零信号"
;
IStatus
[
3
-
1
].
Desp
=
"正向限位"
;
IStatus
[
2
].
Desp
=
"正向限位"
;
IStatus
[
4
-
1
].
Desp
=
"反向限位"
;
IStatus
[
3
].
Desp
=
"反向限位"
;
IStatus
[
7
-
1
].
Desp
=
"急停 & 手动正转"
;
IStatus
[
4
].
Desp
=
"急停 & 手动正转"
;
IStatus
[
8
-
1
].
Desp
=
"急停 & 手动反转"
;
IStatus
[
5
].
Desp
=
"急停 & 手动反转"
;
OStatus
[
4
-
1
].
Desp
=
"报警信号"
;
OStatus
[
3
].
Desp
=
"报警信号"
;
...
...
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Themes/GraphStyle.xaml
View file @
ed7bf665
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
</Style>
</Style>
<!--Axis.Section-->
<!--Axis.Section-->
<!--图表中选择器-->
<Style x:Key="Styles.Axis.Section.Selected" TargetType="lvc:AxisSection" >
<Style x:Key="Styles.Axis.Section.Selected" TargetType="lvc:AxisSection" >
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="DataLabel" Value="False"/>
<Setter Property="DataLabel" Value="False"/>
...
@@ -51,6 +52,35 @@
...
@@ -51,6 +52,35 @@
<!--<Setter Property="Fill" Value="#59F7D8D8"/>-->
<!--<Setter Property="Fill" Value="#59F7D8D8"/>-->
</Style>
</Style>
<!--图表中放大用选择器-->
<Style x:Key="Styles.Axis.Section.Selected.ZoomIn" TargetType="lvc:AxisSection" >
<!--<Setter Property="StrokeThickness" Value="2"/>
<Setter Property="StrokeDashArray" Value="1 1"/>
<Setter Property="DataLabel" Value="True"/>
<Setter Property="DisableAnimations" Value="True"/>
<Setter Property="DataLabelForeground" Value="White"/>
<Setter Property="Opacity" Value="0.1"/>
<Setter Property="Stroke" Value="{StaticResource MahApps.Brushes.Accent2}"/>-->
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="DataLabel" Value="True"/>
<Setter Property="DisableAnimations" Value="True"/>
<Setter Property="DataLabelForeground" Value="White"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Stroke" Value="{StaticResource MahApps.Brushes.Accent2}"/>
</Style>
<!--图表中的边界-->
<Style x:Key="Styles.Axis.Section.Border" TargetType="lvc:AxisSection" >
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="DataLabel" Value="True"/>
<Setter Property="DisableAnimations" Value="True"/>
<Setter Property="DataLabelForeground" Value="White"/>
<Setter Property="Opacity" Value="1"/>
<Setter Property="Panel.ZIndex" Value="1"/>
<Setter Property="Stroke" Value="Orange"/>
</Style>
<!--扫描图,纵向趋势图Y轴 标签-->
<!--扫描图,纵向趋势图Y轴 标签-->
<Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
<Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
<Setter Property="StrokeThickness" Value="1"/>
<Setter Property="StrokeThickness" Value="1"/>
...
@@ -60,4 +90,13 @@
...
@@ -60,4 +90,13 @@
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Opacity" Value="0.5"/>
<Setter Property="Panel.ZIndex" Value="1"/>
<Setter Property="Panel.ZIndex" Value="1"/>
</Style>
</Style>
<Style x:Key="GraphButton" TargetType="Button" BasedOn="{StaticResource Styles.Button.Icon}">
<Setter Property="Margin" Value="48,0,0,-20"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsYAxisTitleHidden}" Value="False">
<Setter Property="Margin" Value="80,0,0,-20"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ResourceDictionary>
</ResourceDictionary>
\ No newline at end of file
Project.FLY.Thick.Base/FLY.Thick.Base.UI/Themes/Styles.xaml
View file @
ed7bf665
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />-->
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
<ResourceDictionary Source="
pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv
.xaml"/>
<ResourceDictionary Source="
GraphStyle
.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary.MergedDictionaries>
<!--<Style TargetType="GroupBox" />-->
</ResourceDictionary>
</ResourceDictionary>
\ 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