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
60aadce1
Commit
60aadce1
authored
Jan 07, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
字段保存于读取
parent
a166200f
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
395 additions
and
270 deletions
+395
-270
VIZ.Package.Module/ControlObject/FieldEdit/View/FieldEditView.xaml
+13
-4
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModel.cs
+67
-121
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModelBase.cs
+169
-0
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditWindowModel.cs
+3
-107
VIZ.Package.Module/ControlObject/FieldTree/ViewModel/FieldTreeViewModel.cs
+22
-2
VIZ.Package.Module/VIZ.Package.Module.csproj
+1
-0
VIZ.Package.Service/DB/ControlObject/ControlObjectService.cs
+117
-0
VIZ.Package.Service/VIZ.Package.Service.csproj
+1
-0
VIZ.Package.Storage/Entity/ControlObject/ControlDynamicFieldEntity.cs
+0
-25
VIZ.Package.Storage/ProjectDbContext.cs
+2
-10
VIZ.Package.Storage/VIZ.Package.Storage.csproj
+0
-1
No files found.
VIZ.Package.Module/ControlObject/FieldEdit/View/FieldEditView.xaml
View file @
60aadce1
...
@@ -8,8 +8,17 @@
...
@@ -8,8 +8,17 @@
d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}"
d:DataContext="{d:DesignInstance Type=local:FieldEditViewModel}"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}"
<Grid.RowDefinitions>
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 按钮组 -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Button Width="80" Height="24" Content="保存字段" Command="{Binding SaveCommand}"></Button>
</StackPanel>
<!-- 字段编辑 -->
<common:NavigationControl ItemsSource="{Binding Path=NavigationConfigs}" Grid.Row="1"
SelectedValue="{Binding Path=SelectedNavigationConfig,Mode=OneWay}"></common:NavigationControl>
</Grid>
</UserControl>
</UserControl>
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModel.cs
View file @
60aadce1
using
System
;
using
DevExpress.Xpf.Core
;
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
...
@@ -7,6 +9,7 @@ using System.Windows;
...
@@ -7,6 +9,7 @@ using System.Windows;
using
VIZ.Framework.Common
;
using
VIZ.Framework.Common
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
using
VIZ.Package.Storage
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Module
namespace
VIZ.Package.Module
...
@@ -14,12 +17,12 @@ namespace VIZ.Package.Module
...
@@ -14,12 +17,12 @@ namespace VIZ.Package.Module
/// <summary>
/// <summary>
/// 字段编辑视图模型
/// 字段编辑视图模型
/// </summary>
/// </summary>
public
class
FieldEditViewModel
:
ViewModelBase
,
IFieldEditService
public
class
FieldEditViewModel
:
FieldEdit
ViewModelBase
,
IFieldEditService
{
{
public
FieldEditViewModel
()
public
FieldEditViewModel
()
{
{
// 初始化
导航配置
// 初始化
命令
this
.
Init
NavigationConfigs
();
this
.
Init
Command
();
// 初始化消息
// 初始化消息
this
.
InitMessage
();
this
.
InitMessage
();
...
@@ -29,115 +32,33 @@ namespace VIZ.Package.Module
...
@@ -29,115 +32,33 @@ namespace VIZ.Package.Module
}
}
/// <summary>
/// <summary>
/// 初始化
消息
/// 初始化
命令
/// </summary>
/// </summary>
private
void
Init
Message
()
private
void
Init
Command
()
{
{
ApplicationDomainEx
.
MessageManager
.
Register
<
ControlFieldChangedMessage
>(
this
,
this
.
OnControlFieldChangedMessag
e
);
this
.
SaveCommand
=
new
VCommand
(
this
.
Sav
e
);
}
}
/// <summary>
/// <summary>
/// 初始化
导航配置
/// 初始化
消息
/// </summary>
/// </summary>
private
void
Init
NavigationConfigs
()
private
void
Init
Message
()
{
{
// 文本编辑器
ApplicationDomainEx
.
MessageManager
.
Register
<
ControlFieldChangedMessage
>(
this
,
this
.
OnControlFieldChangedMessage
);
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
text
.
ToString
(),
ViewType
=
typeof
(
TextEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 富文本编辑器
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
richtext
.
ToString
(),
ViewType
=
typeof
(
RichTextEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// Boolean类型
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
boolean
.
ToString
(),
ViewType
=
typeof
(
BooleanEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 图片选择
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
image
.
ToString
(),
ViewType
=
typeof
(
ImageEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 列表编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
list
.
ToString
(),
ViewType
=
typeof
(
ListEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 数字
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
integer
.
ToString
(),
ViewType
=
typeof
(
IntegerEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 二元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
duplet
.
ToString
(),
ViewType
=
typeof
(
DupletEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 三元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
triplet
.
ToString
(),
ViewType
=
typeof
(
TripletEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
}
}
// =============================================================
// =============================================================
//
Property
//
Field & Service
// =============================================================
// =============================================================
#
region
NavigationConfigs
--
导航配置
private
List
<
NavigationConfig
>
navigationConfigs
=
new
List
<
NavigationConfig
>();
/// <summary>
/// 导航配置
/// </summary>
public
List
<
NavigationConfig
>
NavigationConfigs
{
get
{
return
navigationConfigs
;
}
set
{
navigationConfigs
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
NavigationConfigs
));
}
}
#
endregion
#
region
SelectedNavigationConfig
--
当前选中的导航配置
private
NavigationConfig
selectedNavigationConfig
;
/// <summary>
/// <summary>
///
当前选中的导航配置
///
控制对象服务
/// </summary>
/// </summary>
public
NavigationConfig
SelectedNavigationConfig
private
ControlObjectService
controlObjectService
=
new
ControlObjectService
();
{
get
{
return
selectedNavigationConfig
;
}
set
{
selectedNavigationConfig
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SelectedNavigationConfig
));
}
}
#
endregion
// =============================================================
// Property
// =============================================================
#
region
ControlObject
--
控制对象
#
region
ControlObject
--
控制对象
...
@@ -168,6 +89,52 @@ namespace VIZ.Package.Module
...
@@ -168,6 +89,52 @@ namespace VIZ.Package.Module
#
endregion
#
endregion
// =============================================================
// =============================================================
// Command
// =============================================================
#
region
SaveCommand
--
保存命令
/// <summary>
/// 保存命令
/// </summary>
public
VCommand
SaveCommand
{
get
;
set
;
}
/// <summary>
/// 保存
/// </summary>
private
void
Save
()
{
// 当前没有打开的页或模板 || 当前没有打开的项目
if
(
ApplicationDomainEx
.
CurrentPage
==
null
||
ApplicationDomainEx
.
ProjectDbContext
==
null
)
{
DXMessageBox
.
Show
(
"保存失败!"
);
return
;
}
// 字段树服务不可用
IFieldTreeService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IFieldTreeService
>(
ViewServiceKeys
.
FIELD_TREE_SERVICE
);
if
(
service
==
null
)
{
DXMessageBox
.
Show
(
"保存失败!"
);
return
;
}
// 当前没有控制对象
ControlObjectModel
obj
=
service
.
GetControlObject
();
if
(
obj
==
null
)
{
return
;
}
// 保存
this
.
controlObjectService
.
SaveControlFields
(
ApplicationDomainEx
.
CurrentPage
,
obj
.
AllFiledNodes
);
DXMessageBox
.
Show
(
"保存成功!"
);
}
#
endregion
// =============================================================
// Message
// Message
// =============================================================
// =============================================================
...
@@ -207,29 +174,8 @@ namespace VIZ.Package.Module
...
@@ -207,29 +174,8 @@ namespace VIZ.Package.Module
// Public Function
// Public Function
// =============================================================
// =============================================================
/// <summary>
/// 获取当前正在编辑字段的值
/// </summary>
/// <returns>当前正在编辑字段的值</returns>
public
string
GetCurrentEditFieldValue
()
{
if
(
this
.
SelectedNavigationConfig
==
null
||
this
.
SelectedNavigationConfig
.
View
==
null
)
return
null
;
this
.
SelectedNavigationConfig
.
View
.
TryGetTarget
(
out
object
target
);
FrameworkElement
view
=
target
as
FrameworkElement
;
if
(
view
==
null
)
return
null
;
EditPanelModelBase
vm
=
view
.
DataContext
as
EditPanelModelBase
;
if
(
vm
==
null
)
return
null
;
return
vm
.
GetFieldValue
();
}
// =============================================================
// =============================================================
// Pr
ivate
Function
// Pr
otected
Function
// =============================================================
// =============================================================
/// <summary>
/// <summary>
...
@@ -237,7 +183,7 @@ namespace VIZ.Package.Module
...
@@ -237,7 +183,7 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
/// <param name="config">导航配置</param>
/// <param name="config">导航配置</param>
/// <param name="obj">视图</param>
/// <param name="obj">视图</param>
pr
ivat
e
void
OnViewCreated
(
NavigationConfig
config
,
object
obj
)
pr
otected
overrid
e
void
OnViewCreated
(
NavigationConfig
config
,
object
obj
)
{
{
FrameworkElement
view
=
obj
as
FrameworkElement
;
FrameworkElement
view
=
obj
as
FrameworkElement
;
if
(
view
==
null
)
if
(
view
==
null
)
...
...
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditViewModelBase.cs
0 → 100644
View file @
60aadce1
using
DevExpress.Mvvm.POCO
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
VIZ.Framework.Common
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 字段编辑视图模型
/// </summary>
public
abstract
class
FieldEditViewModelBase
:
ViewModelBase
{
/// <summary>
/// 字段编辑视图模型
/// </summary>
public
FieldEditViewModelBase
()
{
// 初始化导航配置
this
.
InitNavigationConfigs
();
}
/// <summary>
/// 初始化导航配置
/// </summary>
private
void
InitNavigationConfigs
()
{
// 文本编辑器
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
text
.
ToString
(),
ViewType
=
typeof
(
TextEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 富文本编辑器
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
richtext
.
ToString
(),
ViewType
=
typeof
(
RichTextEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// Boolean类型
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
boolean
.
ToString
(),
ViewType
=
typeof
(
BooleanEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 图片选择
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
image
.
ToString
(),
ViewType
=
typeof
(
ImageEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 列表编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
list
.
ToString
(),
ViewType
=
typeof
(
ListEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 数字
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
integer
.
ToString
(),
ViewType
=
typeof
(
IntegerEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 二元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
duplet
.
ToString
(),
ViewType
=
typeof
(
DupletEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 三元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
triplet
.
ToString
(),
ViewType
=
typeof
(
TripletEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
}
// =============================================================
// Property
// =============================================================
#
region
NavigationConfigs
--
导航配置
private
List
<
NavigationConfig
>
navigationConfigs
=
new
List
<
NavigationConfig
>();
/// <summary>
/// 导航配置
/// </summary>
public
List
<
NavigationConfig
>
NavigationConfigs
{
get
{
return
navigationConfigs
;
}
set
{
navigationConfigs
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
NavigationConfigs
));
}
}
#
endregion
#
region
SelectedNavigationConfig
--
当前选中的导航配置
private
NavigationConfig
selectedNavigationConfig
;
/// <summary>
/// 当前选中的导航配置
/// </summary>
public
NavigationConfig
SelectedNavigationConfig
{
get
{
return
selectedNavigationConfig
;
}
set
{
selectedNavigationConfig
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SelectedNavigationConfig
));
}
}
#
endregion
// =============================================================
// Public Function
// =============================================================
/// <summary>
/// 获取当前正在编辑字段的值
/// </summary>
/// <returns>当前正在编辑字段的值</returns>
public
string
GetCurrentEditFieldValue
()
{
if
(
this
.
SelectedNavigationConfig
==
null
||
this
.
SelectedNavigationConfig
.
View
==
null
)
return
null
;
this
.
SelectedNavigationConfig
.
View
.
TryGetTarget
(
out
object
target
);
FrameworkElement
view
=
target
as
FrameworkElement
;
if
(
view
==
null
)
return
null
;
EditPanelModelBase
vm
=
view
.
DataContext
as
EditPanelModelBase
;
if
(
vm
==
null
)
return
null
;
return
vm
.
GetFieldValue
();
}
// =============================================================
// Private Function
// =============================================================
/// <summary>
/// 视图创建后触发
/// </summary>
/// <param name="config">导航配置</param>
/// <param name="obj">视图</param>
protected
abstract
void
OnViewCreated
(
NavigationConfig
config
,
object
obj
);
}
}
\ No newline at end of file
VIZ.Package.Module/ControlObject/FieldEdit/ViewModel/FieldEditWindowModel.cs
View file @
60aadce1
...
@@ -16,116 +16,12 @@ namespace VIZ.Package.Module
...
@@ -16,116 +16,12 @@ namespace VIZ.Package.Module
/// <summary>
/// <summary>
/// 字段编辑窗口视图模型
/// 字段编辑窗口视图模型
/// </summary>
/// </summary>
public
class
FieldEditWindowModel
:
ViewModelBase
public
class
FieldEditWindowModel
:
FieldEdit
ViewModelBase
{
{
public
FieldEditWindowModel
()
{
// 初始化导航配置
this
.
InitNavigationConfigs
();
}
/// <summary>
/// 初始化导航配置
/// </summary>
private
void
InitNavigationConfigs
()
{
// 文本编辑器
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
text
.
ToString
(),
ViewType
=
typeof
(
TextEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 富文本编辑器
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
richtext
.
ToString
(),
ViewType
=
typeof
(
RichTextEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// Boolean类型
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
boolean
.
ToString
(),
ViewType
=
typeof
(
BooleanEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 图片选择
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
image
.
ToString
(),
ViewType
=
typeof
(
ImageEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 列表编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
list
.
ToString
(),
ViewType
=
typeof
(
ListEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 数字
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
integer
.
ToString
(),
ViewType
=
typeof
(
IntegerEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 二元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
duplet
.
ToString
(),
ViewType
=
typeof
(
DupletEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
// 三元编辑
this
.
NavigationConfigs
.
Add
(
new
NavigationConfig
{
Key
=
VizControlFieldType
.
triplet
.
ToString
(),
ViewType
=
typeof
(
TripletEditPanel
),
ViewCreated
=
this
.
OnViewCreated
});
}
// =============================================================
// =============================================================
// Property
// Property
// =============================================================
// =============================================================
#
region
NavigationConfigs
--
导航配置
private
List
<
NavigationConfig
>
navigationConfigs
=
new
List
<
NavigationConfig
>();
/// <summary>
/// 导航配置
/// </summary>
public
List
<
NavigationConfig
>
NavigationConfigs
{
get
{
return
navigationConfigs
;
}
set
{
navigationConfigs
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
NavigationConfigs
));
}
}
#
endregion
#
region
SelectedNavigationConfig
--
当前选中的导航配置
private
NavigationConfig
selectedNavigationConfig
;
/// <summary>
/// 当前选中的导航配置
/// </summary>
public
NavigationConfig
SelectedNavigationConfig
{
get
{
return
selectedNavigationConfig
;
}
set
{
selectedNavigationConfig
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SelectedNavigationConfig
));
}
}
#
endregion
#
region
ColumnDefinition
--
列定义
#
region
ColumnDefinition
--
列定义
private
GridColumnDefinition
columnDefinition
;
private
GridColumnDefinition
columnDefinition
;
...
@@ -224,7 +120,7 @@ namespace VIZ.Package.Module
...
@@ -224,7 +120,7 @@ namespace VIZ.Package.Module
}
}
// =============================================================
// =============================================================
// Pr
ivate
Function
// Pr
otected
Function
// =============================================================
// =============================================================
/// <summary>
/// <summary>
...
@@ -232,7 +128,7 @@ namespace VIZ.Package.Module
...
@@ -232,7 +128,7 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
/// <param name="config">导航配置</param>
/// <param name="config">导航配置</param>
/// <param name="obj">视图</param>
/// <param name="obj">视图</param>
pr
ivat
e
void
OnViewCreated
(
NavigationConfig
config
,
object
obj
)
pr
otected
overrid
e
void
OnViewCreated
(
NavigationConfig
config
,
object
obj
)
{
{
FrameworkElement
view
=
obj
as
FrameworkElement
;
FrameworkElement
view
=
obj
as
FrameworkElement
;
if
(
view
==
null
)
if
(
view
==
null
)
...
...
VIZ.Package.Module/ControlObject/FieldTree/ViewModel/FieldTreeViewModel.cs
View file @
60aadce1
...
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
...
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Service
;
using
VIZ.Package.Service
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Module
namespace
VIZ.Package.Module
{
{
...
@@ -53,6 +54,11 @@ namespace VIZ.Package.Module
...
@@ -53,6 +54,11 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
private
VizCommandControlObjectService
vizCommandControlObjectService
=
new
VizCommandControlObjectService
();
private
VizCommandControlObjectService
vizCommandControlObjectService
=
new
VizCommandControlObjectService
();
/// <summary>
/// 控制对象服务
/// </summary>
private
ControlObjectService
controlObjectService
=
new
ControlObjectService
();
// =============================================================
// =============================================================
// Property
// Property
// =============================================================
// =============================================================
...
@@ -131,12 +137,23 @@ namespace VIZ.Package.Module
...
@@ -131,12 +137,23 @@ namespace VIZ.Package.Module
ThreadHelper
.
SafeRun
(
action
:
()
=>
ThreadHelper
.
SafeRun
(
action
:
()
=>
{
{
// 获取控制对象
ControlObjectModel
controlObject
=
this
.
vizCommandControlObjectService
.
GetControlObject
(
ApplicationDomainEx
.
PreviewConn
);
ControlObjectModel
controlObject
=
this
.
vizCommandControlObjectService
.
GetControlObject
(
ApplicationDomainEx
.
PreviewConn
);
WPFHelper
.
BeginInvoke
(()
=>
// 从本地数据库中获取字段数据
List
<
ControlFieldEntity
>
fields
=
this
.
controlObjectService
.
GetControlFields
(
msg
.
Page
);
// 从本地数据库中更新值
controlObjectService
.
UpdateControlFieldValue
(
controlObject
.
AllFiledNodes
,
fields
);
WPFHelper
.
Invoke
(()
=>
{
{
this
.
ControlObject
=
controlObject
;
this
.
ControlObject
=
controlObject
;
});
});
// 将当前值上至预览
this
.
vizCommandControlObjectService
.
SetControlObject
(
ApplicationDomainEx
.
PreviewConn
,
this
.
ControlObject
);
},
final
:
()
=>
},
final
:
()
=>
{
{
WPFHelper
.
BeginInvoke
(()
=>
WPFHelper
.
BeginInvoke
(()
=>
...
@@ -184,7 +201,10 @@ namespace VIZ.Package.Module
...
@@ -184,7 +201,10 @@ namespace VIZ.Package.Module
if
(
oldField
!=
null
&&
oldField
.
Type
==
Storage
.
VizControlFieldType
.
list
)
if
(
oldField
!=
null
&&
oldField
.
Type
==
Storage
.
VizControlFieldType
.
list
)
{
{
IFieldEditService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IFieldEditService
>(
ViewServiceKeys
.
FIELD_EDIT_SERVICE
);
IFieldEditService
service
=
ApplicationDomainEx
.
ServiceManager
.
GetService
<
IFieldEditService
>(
ViewServiceKeys
.
FIELD_EDIT_SERVICE
);
if
(
service
!=
null
)
{
oldField
.
Value
=
service
.
GetCurrentEditFieldValue
();
}
}
}
}
}
}
}
...
...
VIZ.Package.Module/VIZ.Package.Module.csproj
View file @
60aadce1
...
@@ -91,6 +91,7 @@
...
@@ -91,6 +91,7 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\Service\IFieldEditService.cs" />
<Compile Include="ControlObject\FieldEdit\ViewModel\FieldEditViewModelBase.cs" />
<Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" />
<Compile Include="ControlObject\FieldTree\Service\IFieldTreeService.cs" />
<Compile Include="Main\ViewModel\MainConnViewModel.cs" />
<Compile Include="Main\ViewModel\MainConnViewModel.cs" />
<Compile Include="Main\View\MainConnView.xaml.cs">
<Compile Include="Main\View\MainConnView.xaml.cs">
...
...
VIZ.Package.Service/DB/ControlObject/ControlObjectService.cs
0 → 100644
View file @
60aadce1
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Service
{
/// <summary>
/// 控制对象服务
/// </summary>
public
class
ControlObjectService
{
/// <summary>
/// 保存控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="fields">控制字段</param>
public
void
SaveControlFields
(
PageModelBase
pageBase
,
IList
<
ControlFieldNodeModel
>
fields
)
{
Guid
id
=
Guid
.
Empty
;
if
(
pageBase
is
PageTemplateModel
template
)
{
id
=
template
.
TemplateID
;
}
else
if
(
pageBase
is
PageModel
page
)
{
id
=
page
.
PageID
;
}
ILiteCollection
<
ControlFieldEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
id
);
collection
.
DeleteAll
();
List
<
ControlFieldEntity
>
list
=
new
List
<
ControlFieldEntity
>();
foreach
(
ControlFieldNodeModel
field
in
fields
)
{
ControlFieldEntity
entity
=
new
ControlFieldEntity
();
entity
.
FieldIdentifier
=
field
.
FieldIdentifier
;
entity
.
Value
=
field
.
Value
;
entity
.
Type
=
field
.
Type
;
list
.
Add
(
entity
);
}
collection
.
Insert
(
list
);
}
/// <summary>
/// 保存控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="fields">控制字段</param>
public
void
SaveControlFields
(
PageModelBase
pageBase
,
IList
<
ControlFieldEntity
>
fields
)
{
Guid
id
=
Guid
.
Empty
;
if
(
pageBase
is
PageTemplateModel
template
)
{
id
=
template
.
TemplateID
;
}
else
if
(
pageBase
is
PageModel
page
)
{
id
=
page
.
PageID
;
}
ILiteCollection
<
ControlFieldEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
id
);
collection
.
DeleteAll
();
collection
.
Insert
(
fields
);
}
/// <summary>
/// 获取控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <returns>控制字段</returns>
public
List
<
ControlFieldEntity
>
GetControlFields
(
PageModelBase
pageBase
)
{
Guid
id
=
Guid
.
Empty
;
if
(
pageBase
is
PageTemplateModel
template
)
{
id
=
template
.
TemplateID
;
}
else
if
(
pageBase
is
PageModel
page
)
{
id
=
page
.
PageID
;
}
ILiteCollection
<
ControlFieldEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
id
);
return
collection
.
FindAll
().
ToList
();
}
/// <summary>
/// 更新控制字段值
/// </summary>
/// <param name="models">模型</param>
/// <param name="entitys">实体</param>
public
void
UpdateControlFieldValue
(
IList
<
ControlFieldNodeModel
>
models
,
IList
<
ControlFieldEntity
>
entitys
)
{
Dictionary
<
string
,
ControlFieldEntity
>
dic
=
entitys
.
ToDictionary
(
p
=>
p
.
FieldIdentifier
,
p
=>
p
);
foreach
(
ControlFieldNodeModel
model
in
models
)
{
if
(!
dic
.
TryGetValue
(
model
.
FieldIdentifier
,
out
ControlFieldEntity
entity
))
continue
;
if
(
model
.
Type
!=
entity
.
Type
)
continue
;
model
.
Value
=
entity
.
Value
;
}
}
}
}
VIZ.Package.Service/VIZ.Package.Service.csproj
View file @
60aadce1
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="DB\Conn\ConnService.cs" />
<Compile Include="DB\Conn\ConnService.cs" />
<Compile Include="DB\ControlObject\ControlObjectService.cs" />
<Compile Include="DB\Page\PageService.cs" />
<Compile Include="DB\Page\PageService.cs" />
<Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Logic\Plugin\PluginService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
...
...
VIZ.Package.Storage/Entity/ControlObject/ControlDynamicFieldEntity.cs
deleted
100644 → 0
View file @
a166200f
using
LiteDB
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.Package.Storage
{
/// <summary>
/// 控制动态字段实体
/// </summary>
public
class
ControlDynamicFieldEntity
:
ControlFieldEntity
{
/// <summary>
/// 所属字段
/// </summary>
public
string
OwnerFieldIdentifier
{
get
;
set
;
}
/// <summary>
/// 行数, 从0开始
/// </summary>
public
int
Row
{
get
;
set
;
}
}
}
VIZ.Package.Storage/ProjectDbContext.cs
View file @
60aadce1
...
@@ -66,17 +66,9 @@ namespace VIZ.Package.Storage
...
@@ -66,17 +66,9 @@ namespace VIZ.Package.Storage
/// <returns>控制字段</returns>
/// <returns>控制字段</returns>
public
ILiteCollection
<
ControlFieldEntity
>
GetControlFiled
(
Guid
id
)
public
ILiteCollection
<
ControlFieldEntity
>
GetControlFiled
(
Guid
id
)
{
{
return
this
.
Database
.
GetCollection
<
ControlFieldEntity
>(
id
.
ToString
());
string
name
=
$"PAGE_
{
id
.
ToString
().
Replace
(
"-"
,
string
.
Empty
)}
"
;
}
/// <summary>
return
this
.
Database
.
GetCollection
<
ControlFieldEntity
>(
name
);
/// 根据ID获取控制动态字段, ID 为 TemplateID 或者 PageID
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
/// <returns>控制动态字段</returns>
public
ILiteCollection
<
ControlDynamicFieldEntity
>
GetControlDynamicFiled
(
Guid
id
)
{
return
this
.
Database
.
GetCollection
<
ControlDynamicFieldEntity
>(
id
.
ToString
());
}
}
/// <summary>
/// <summary>
...
...
VIZ.Package.Storage/VIZ.Package.Storage.csproj
View file @
60aadce1
...
@@ -70,7 +70,6 @@
...
@@ -70,7 +70,6 @@
<Compile Include="Entity\Config\ConfigContext.cs" />
<Compile Include="Entity\Config\ConfigContext.cs" />
<Compile Include="Entity\Conn\ConnEntity.cs" />
<Compile Include="Entity\Conn\ConnEntity.cs" />
<Compile Include="Entity\Conn\ConnGroupEntity.cs" />
<Compile Include="Entity\Conn\ConnGroupEntity.cs" />
<Compile Include="Entity\ControlObject\ControlDynamicFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.cs" />
<Compile Include="Entity\Page\PageEntityBase.cs" />
<Compile Include="Entity\Page\PageEntityBase.cs" />
<Compile Include="Entity\Page\PageEntity.cs" />
<Compile Include="Entity\Page\PageEntity.cs" />
...
...
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