Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Package
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.Package
Commits
0a7cf5aa
Commit
0a7cf5aa
authored
Jan 10, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 关闭系统时提示是否关闭Viz引擎
2. 添加Float类型编辑器
parent
cf62a529
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
377 additions
and
3 deletions
+377
-3
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanel.xaml
+30
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanel.xaml.cs
+31
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanelModel.cs
+139
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/FloatListCellEdit.xaml
+22
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/FloatListCellEdit.xaml.cs
+75
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/ListEditPanel.xaml
+6
-0
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/ListEditPanelCellTemplateSelector.cs
+6
-0
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModelBase.cs
+8
-0
VIZ.Package.Module/Preview/VizPreview/ViewModel/VizPreviewViewModel.cs
+26
-1
VIZ.Package.Module/VIZ.Package.Module.csproj
+15
-0
VIZ.Package.Service/Viz/VizCommandControlObjectService.cs
+4
-0
VIZ.Package.Storage/Enum/VizControlFieldType.cs
+6
-0
VIZ.Package/MainWindow.xaml.cs
+9
-2
No files found.
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanel.xaml
0 → 100644
View file @
0a7cf5aa
<UserControl x:Class="VIZ.Package.Module.FloatEditPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
d:DataContext="{d:DesignInstance Type=local:FloatEditPanelModel}"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="50" d:DesignWidth="600">
<Grid VerticalAlignment="Top" Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="值:" VerticalAlignment="Center" HorizontalAlignment="Right"></TextBlock>
<dxe:TextEdit AcceptsReturn="True" VerticalAlignment="Top" HorizontalAlignment="Left"
Width="200" Grid.Column="1"
MaskType="Numeric" Margin="20,0,0,0"
EditValue="{Binding Path=EditValue,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></dxe:TextEdit>
</Grid>
</UserControl>
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanel.xaml.cs
0 → 100644
View file @
0a7cf5aa
using
System
;
using
System.Collections.Generic
;
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
VIZ.Framework.Core
;
namespace
VIZ.Package.Module
{
/// <summary>
/// FloatEditPanel.xaml 的交互逻辑
/// </summary>
public
partial
class
FloatEditPanel
:
UserControl
{
public
FloatEditPanel
()
{
InitializeComponent
();
WPFHelper
.
BindingViewModel
(
this
,
new
FloatEditPanelModel
());
}
}
}
VIZ.Package.Module/ControlObject/FieldEdit/Edit/FloatEdit/FloatEditPanelModel.cs
0 → 100644
View file @
0a7cf5aa
using
System
;
using
System.Collections.Generic
;
using
System.Dynamic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 浮点数字编辑面板模型
/// </summary>
public
class
FloatEditPanelModel
:
EditPanelModelBase
{
// ============================================================
// Property
// ============================================================
private
double
editValue
;
/// <summary>
/// 编辑值
/// </summary>
public
double
EditValue
{
get
{
return
editValue
;
}
set
{
editValue
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
EditValue
));
this
.
OnEditValueChanged
();
}
}
// ============================================================
// Message
// ============================================================
// ============================================================
// Public Function
// ============================================================
/// <summary>
/// 更新
/// </summary>
/// <param name="controlObject">控制对象</param>
/// <param name="controlField">控制字段</param>
public
override
void
Update
(
ControlObjectModel
controlObject
,
ControlFieldNodeModel
controlField
)
{
base
.
Update
(
controlObject
,
controlField
);
this
.
IsSendToPreview
=
false
;
double
.
TryParse
(
controlField
?.
Value
,
out
double
value
);
this
.
EditValue
=
value
;
this
.
IsSendToPreview
=
true
;
}
/// <summary>
/// 更新动态数据
/// </summary>
/// <param name="listCellEdit">列单元格编辑器</param>
/// <param name="columnDefinition">列定义</param>
/// <param name="rowHandle">行号</param>
/// <param name="row">行数据</param>
public
override
void
UpdateDynamic
(
ListCellEditBase
listCellEdit
,
GridColumnDefinition
columnDefinition
,
int
rowHandle
,
ExpandoObject
row
)
{
base
.
UpdateDynamic
(
listCellEdit
,
columnDefinition
,
rowHandle
,
row
);
IDictionary
<
string
,
object
>
dic
=
row
as
IDictionary
<
string
,
object
>;
this
.
IsSendToPreview
=
false
;
double
.
TryParse
(
dic
?[
columnDefinition
.
FieldName
]?.
ToString
(),
out
double
value
);
this
.
EditValue
=
value
;
this
.
IsSendToPreview
=
true
;
}
/// <summary>
/// 获取字段值
/// </summary>
/// <returns>字段值</returns>
public
override
string
GetFieldValue
()
{
return
this
.
EditValue
.
ToString
();
}
// ============================================================
// Private Function
// ============================================================
/// <summary>
/// 值改变时触发
/// </summary>
private
void
OnEditValueChanged
()
{
// 不需要向预览发送值
if
(!
this
.
IsSendToPreview
)
return
;
// 没有预览连接
if
(
ApplicationDomainEx
.
PreviewConn
==
null
)
return
;
// 没有控制对象或控制字段
if
(
this
.
ControlObject
==
null
||
this
.
ControlField
==
null
)
return
;
// 正常模式编辑
if
(
this
.
FieldEditMode
==
FieldEditMode
.
Normal
)
{
this
.
ControlField
.
Value
=
this
.
EditValue
.
ToString
();
this
.
VizCommandControlObjectService
.
SetControlObjectValue
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
.
TreeNodePath
,
this
.
ControlField
.
FieldIdentifier
,
this
.
ControlField
.
Value
);
return
;
}
// 没有列信息或行数据
if
(
this
.
ColumnDefinition
==
null
||
this
.
Row
==
null
)
return
;
// 动态模式编辑
if
(
this
.
FieldEditMode
==
FieldEditMode
.
Dynamic
)
{
IDictionary
<
string
,
object
>
dic
=
this
.
Row
as
IDictionary
<
string
,
object
>;
dic
[
this
.
ColumnDefinition
.
FieldName
]
=
this
.
EditValue
.
ToString
();
this
.
ListCellEdit
.
UpdateEditValue
(
this
.
ColumnDefinition
,
this
.
RowHandle
,
this
.
Row
);
return
;
}
}
}
}
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/FloatListCellEdit.xaml
0 → 100644
View file @
0a7cf5aa
<local:ListCellEditBase x:Class="VIZ.Package.Module.FloatListCellEdit"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:storage="clr-namespace:VIZ.Package.Storage;assembly=VIZ.Package.Storage"
xmlns:resource="clr-namespace:VIZ.Package.Module.Resource;assembly=VIZ.Package.Module.Resource"
xmlns:local="clr-namespace:VIZ.Package.Module"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="30" d:DesignWidth="200">
<Grid>
<dxe:TextEdit x:Name="PART_Text"
MaskType="Numeric" EditValueChanged="EditValueChanged"></dxe:TextEdit>
</Grid>
</local:ListCellEditBase>
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/CellEdit/FloatListCellEdit.xaml.cs
0 → 100644
View file @
0a7cf5aa
using
System
;
using
System.Collections.Generic
;
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
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
namespace
VIZ.Package.Module
{
/// <summary>
/// FloatListCellEdit.xaml 的交互逻辑
/// </summary>
public
partial
class
FloatListCellEdit
:
ListCellEditBase
{
public
FloatListCellEdit
()
{
InitializeComponent
();
}
/// <summary>
/// 数据上下文改变时触发
/// </summary>
/// <param name="e">事件参数</param>
protected
override
void
OnDataContextChanged
(
DependencyPropertyChangedEventArgs
e
)
{
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
cellData
=
e
.
NewValue
as
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
;
this
.
IsSendToPreview
=
false
;
double
.
TryParse
(
cellData
?.
Value
?.
ToString
(),
out
double
value
);
this
.
PART_Text
.
EditValue
=
value
;
this
.
IsSendToPreview
=
true
;
}
/// <summary>
/// 值改变时触发
/// </summary>
private
void
EditValueChanged
(
object
sender
,
DevExpress
.
Xpf
.
Editors
.
EditValueChangedEventArgs
e
)
{
// 是否需要发送至预览
if
(!
this
.
IsSendToPreview
)
return
;
// 预览连接不存在
if
(
ApplicationDomainEx
.
PreviewConn
==
null
)
return
;
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
cellData
=
this
.
DataContext
as
DevExpress
.
Xpf
.
Grid
.
EditGridCellData
;
if
(
cellData
==
null
)
return
;
GridColumnDefinition
columnDefinition
=
cellData
.
Column
.
DataContext
as
GridColumnDefinition
;
if
(
columnDefinition
==
null
)
return
;
// 向Viz发送指令
this
.
VizCommandControlObjectService
.
SetControlObjectListValue
(
ApplicationDomainEx
.
PreviewConn
,
columnDefinition
.
ControlObject
.
TreeNodePath
,
columnDefinition
.
ControlField
.
FieldIdentifier
,
cellData
.
RowData
.
RowHandle
.
Value
,
columnDefinition
.
FieldName
,
e
.
NewValue
?.
ToString
());
}
}
}
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/ListEditPanel.xaml
View file @
0a7cf5aa
...
...
@@ -78,6 +78,12 @@
<local:IntegerListCellEdit></local:IntegerListCellEdit>
</DataTemplate>
</local:ListEditPanelCellTemplateSelector.IntegerDataTemplate>
<!-- 浮点数字 -->
<local:ListEditPanelCellTemplateSelector.FloatDataTemplate>
<DataTemplate>
<local:FloatListCellEdit></local:FloatListCellEdit>
</DataTemplate>
</local:ListEditPanelCellTemplateSelector.FloatDataTemplate>
</local:ListEditPanelCellTemplateSelector>
<!-- 列定义模板 -->
...
...
VIZ.Package.Module/ControlObject/FieldEdit/Edit/ListEdit/ListEditPanelCellTemplateSelector.cs
View file @
0a7cf5aa
...
...
@@ -43,6 +43,11 @@ namespace VIZ.Package.Module
public
DataTemplate
IntegerDataTemplate
{
get
;
set
;
}
/// <summary>
/// 浮点数字
/// </summary>
public
DataTemplate
FloatDataTemplate
{
get
;
set
;
}
/// <summary>
/// 二元组
/// </summary>
public
DataTemplate
DupletDataTemplate
{
get
;
set
;
}
...
...
@@ -72,6 +77,7 @@ namespace VIZ.Package.Module
case
VizControlFieldType
.
text
:
return
this
.
TextDataTemplate
;
case
VizControlFieldType
.
boolean
:
return
this
.
BooleanDataTemplate
;
case
VizControlFieldType
.
integer
:
return
this
.
IntegerDataTemplate
;
case
VizControlFieldType
.
@float
:
return
this
.
FloatDataTemplate
;
case
VizControlFieldType
.
richtext
:
return
this
.
RichTextDataTemplate
;
case
VizControlFieldType
.
image
:
return
this
.
ImageDataTemplate
;
case
VizControlFieldType
.
list
:
return
this
.
TextDataTemplate
;
...
...
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModelBase.cs
View file @
0a7cf5aa
...
...
@@ -79,6 +79,14 @@ namespace VIZ.Package.Module
ViewCreated
=
this
.
OnViewCreated
});
// 浮点数字
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
@float
.
ToString
(),
ViewType
=
typeof
(
FloatEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 二元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
...
...
VIZ.Package.Module/Preview/VizPreview/ViewModel/VizPreviewViewModel.cs
View file @
0a7cf5aa
using
log4net
;
using
DevExpress.Xpf.Core
;
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Connection
;
using
VIZ.Package.Domain
;
...
...
@@ -69,6 +71,7 @@ namespace VIZ.Package.Module
private
void
initMessage
()
{
ApplicationDomainEx
.
MessageManager
.
Register
<
PageOpenMessage
>(
this
,
this
.
OnPageOpenMessage
);
ApplicationDomainEx
.
MessageManager
.
Register
<
ApplicationCloseMessage
>(
this
,
this
.
OnApplicationCloseMessage
);
}
// ================================================================================
...
...
@@ -488,6 +491,28 @@ namespace VIZ.Package.Module
});
}
/// <summary>
/// 应用程序关闭消息
/// </summary>
/// <param name="msg">消息</param>
private
void
OnApplicationCloseMessage
(
ApplicationCloseMessage
msg
)
{
if
(
ApplicationDomainEx
.
VizPreviewProcess
==
null
||
ApplicationDomainEx
.
VizPreviewProcess
.
HasExited
)
return
;
if
(
DXMessageBox
.
Show
(
"是否关闭Viz引擎?"
,
"提示"
,
MessageBoxButton
.
YesNo
)
!=
MessageBoxResult
.
Yes
)
return
;
try
{
ApplicationDomainEx
.
VizPreviewProcess
.
Kill
();
}
catch
(
Exception
ex
)
{
log
.
Error
(
ex
);
}
}
// ================================================================================
// Public Function
// ================================================================================
...
...
VIZ.Package.Module/VIZ.Package.Module.csproj
View file @
0a7cf5aa
...
...
@@ -90,6 +90,13 @@
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
<ItemGroup>
<Compile Include="ControlObject\FieldEdit\Edit\FloatEdit\FloatEditPanel.xaml.cs">
<DependentUpon>FloatEditPanel.xaml</DependentUpon>
</Compile>
<Compile Include="ControlObject\FieldEdit\Edit\FloatEdit\FloatEditPanelModel.cs" />
<Compile Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\FloatListCellEdit.xaml.cs">
<DependentUpon>FloatListCellEdit.xaml</DependentUpon>
</Compile>
<Compile Include="Help\About\View\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
...
...
@@ -334,6 +341,14 @@
<Folder Include="Main\Controller\" />
</ItemGroup>
<ItemGroup>
<Page Include="ControlObject\FieldEdit\Edit\FloatEdit\FloatEditPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="ControlObject\FieldEdit\Edit\ListEdit\CellEdit\FloatListCellEdit.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Help\About\View\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
...
...
VIZ.Package.Service/Viz/VizCommandControlObjectService.cs
View file @
0a7cf5aa
...
...
@@ -28,6 +28,7 @@ namespace VIZ.Package.Service
VizControlFieldType
.
boolean
,
VizControlFieldType
.
image
,
VizControlFieldType
.
integer
,
VizControlFieldType
.
@float
,
VizControlFieldType
.
duplet
,
VizControlFieldType
.
triplet
};
...
...
@@ -376,6 +377,9 @@ namespace VIZ.Package.Service
if
(
type
==
"integer"
)
return
VizControlFieldType
.
integer
;
if
(
type
==
"float"
)
return
VizControlFieldType
.
@float
;
if
(
type
==
"duplet"
)
return
VizControlFieldType
.
duplet
;
...
...
VIZ.Package.Storage/Enum/VizControlFieldType.cs
View file @
0a7cf5aa
...
...
@@ -55,6 +55,12 @@ namespace VIZ.Package.Storage
integer
,
/// <summary>
/// 浮点数字
/// </summary>
[
Description
(
"浮点数字"
)]
@float
,
/// <summary>
/// 二元组
/// </summary>
[
Description
(
"二元组"
)]
...
...
VIZ.Package/MainWindow.xaml.cs
View file @
0a7cf5aa
...
...
@@ -31,13 +31,14 @@ namespace VIZ.Package
{
InitializeComponent
();
this
.
Closing
+=
MainWindow_Closing
;
this
.
Closed
+=
MainWindow_Closed
;
}
/// <summary>
/// 关闭窗口
/// 关闭窗口
前触发
/// </summary>
private
void
MainWindow_Clos
ed
(
object
sender
,
EventArgs
e
)
private
void
MainWindow_Clos
ing
(
object
sender
,
System
.
ComponentModel
.
Cancel
EventArgs
e
)
{
// 发送系统关闭消息
try
...
...
@@ -49,7 +50,13 @@ namespace VIZ.Package
{
log
.
Error
(
ex
);
}
}
/// <summary>
/// 关闭窗口
/// </summary>
private
void
MainWindow_Closed
(
object
sender
,
EventArgs
e
)
{
// 启动结束流程
AppSetup
.
ShutDown
();
...
...
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