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
f33e1d02
Commit
f33e1d02
authored
Feb 01, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加插件映射设置,添加页时默认使用映射的插件
parent
ccbb18c2
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
610 additions
and
5 deletions
+610
-5
VIZ.Package.Domain/ApplicationDomainEx.cs
+5
-0
VIZ.Package.Domain/Enum/ModulePluginIds.cs
+5
-0
VIZ.Package.Module.Resource/Icons/add_32x32.png
+0
-0
VIZ.Package.Module.Resource/Icons/delete_32x32.png
+0
-0
VIZ.Package.Module.Resource/Style/IconButton/IconButton_Default.xaml
+38
-0
VIZ.Package.Module.Resource/VIZ.Package.Module.Resource.csproj
+5
-0
VIZ.Package.Module/Login/ViewModel/LoginViewModel.cs
+1
-1
VIZ.Package.Module/Main/ViewModel/MainViewModel.cs
+0
-2
VIZ.Package.Module/Page/Group/ViewModel/PageAddViewModel.cs
+7
-1
VIZ.Package.Module/Plugin/View/PluginView.xaml
+5
-0
VIZ.Package.Module/Plugin/ViewModel/PluginViewModel.cs
+47
-1
VIZ.Package.Module/Setting/PluginMapping/Model/PluginMappingModel.cs
+43
-0
VIZ.Package.Module/Setting/PluginMapping/PluginMappingSettingPluginLifeCycle.cs
+58
-0
VIZ.Package.Module/Setting/PluginMapping/View/PluginMappingSettingView.xaml
+93
-0
VIZ.Package.Module/Setting/PluginMapping/View/PluginMappingSettingView.xaml.cs
+41
-0
VIZ.Package.Module/Setting/PluginMapping/ViewModel/PluginMappingSettingViewModel.cs
+197
-0
VIZ.Package.Module/VIZ.Package.Module.csproj
+10
-0
VIZ.Package.Storage/Entity/Config/PluginMappingConfigEntity.cs
+47
-0
VIZ.Package.Storage/LocalDbContext.cs
+7
-0
VIZ.Package.Storage/VIZ.Package.Storage.csproj
+1
-0
No files found.
VIZ.Package.Domain/ApplicationDomainEx.cs
View file @
f33e1d02
...
@@ -83,6 +83,11 @@ namespace VIZ.Package.Domain
...
@@ -83,6 +83,11 @@ namespace VIZ.Package.Domain
/// </summary>
/// </summary>
public
static
List
<
PluginInfo
>
PluginInfos
{
get
;
set
;
}
public
static
List
<
PluginInfo
>
PluginInfos
{
get
;
set
;
}
/// <summary>
/// 插件映射配置
/// </summary>
public
static
PluginMappingConfigEntity
PluginMappingConfig
{
get
;
set
;
}
// =============================================================
// =============================================================
// 其他
// 其他
// =============================================================
// =============================================================
...
...
VIZ.Package.Domain/Enum/ModulePluginIds.cs
View file @
f33e1d02
...
@@ -82,5 +82,10 @@ namespace VIZ.Package.Domain
...
@@ -82,5 +82,10 @@ namespace VIZ.Package.Domain
/// 媒资库设置
/// 媒资库设置
/// </summary>
/// </summary>
public
const
string
MEDIA_CONFIG_SETTING
=
"MEDIA_CONFIG_SETTING"
;
public
const
string
MEDIA_CONFIG_SETTING
=
"MEDIA_CONFIG_SETTING"
;
/// <summary>
/// 插件映射设置
/// </summary>
public
const
string
PLUGIN_MAPPING_SETTING
=
"PLUGIN_MAPPING_SETTING"
;
}
}
}
}
VIZ.Package.Module.Resource/Icons/add_32x32.png
0 → 100644
View file @
f33e1d02
698 Bytes
VIZ.Package.Module.Resource/Icons/delete_32x32.png
0 → 100644
View file @
f33e1d02
309 Bytes
VIZ.Package.Module.Resource/Style/IconButton/IconButton_Default.xaml
View file @
f33e1d02
...
@@ -121,4 +121,41 @@
...
@@ -121,4 +121,41 @@
</Setter>
</Setter>
</Style>
</Style>
<!-- IconButton_Menu_Mask -->
<Style x:Key="IconButton_Menu_Mask" TargetType="fcommon:IconButton">
<Setter Property="FocusVisualStyle" Value="{x:Null}"></Setter>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Width" Value="30"></Setter>
<Setter Property="Height" Value="30"></Setter>
<Setter Property="IconWidth" Value="20"></Setter>
<Setter Property="IconHeight" Value="20"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="fcommon:IconButton">
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<Border x:Name="icon" Background="#BBFFFFFF" VerticalAlignment="Center" HorizontalAlignment="Center"
Width="{TemplateBinding IconWidth}" Height="{TemplateBinding IconHeight}">
<Border.OpacityMask>
<ImageBrush ImageSource="{Binding Icon,RelativeSource={RelativeSource AncestorType=fcommon:IconButton,Mode=FindAncestor}}"></ImageBrush>
</Border.OpacityMask>
</Border>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#11FFFFFF"></Setter>
<Setter TargetName="icon" Property="Background" Value="#FF4E4BDE"></Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="icon" Property="Background" Value="#AA4E4BDE"></Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</ResourceDictionary>
\ No newline at end of file
VIZ.Package.Module.Resource/VIZ.Package.Module.Resource.csproj
View file @
f33e1d02
...
@@ -215,5 +215,9 @@
...
@@ -215,5 +215,9 @@
<ItemGroup>
<ItemGroup>
<Resource Include="Icons\preview_connection_32x32.png" />
<Resource Include="Icons\preview_connection_32x32.png" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<Resource Include="Icons\add_32x32.png" />
<Resource Include="Icons\delete_32x32.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
\ No newline at end of file
VIZ.Package.Module/Login/ViewModel/LoginViewModel.cs
View file @
f33e1d02
...
@@ -224,7 +224,7 @@ namespace VIZ.Package.Module
...
@@ -224,7 +224,7 @@ namespace VIZ.Package.Module
mediaConfig
=
mediaConfig
??
new
MediaConfigEntity
();
mediaConfig
=
mediaConfig
??
new
MediaConfigEntity
();
ApplicationDomainEx
.
MediaConfig
=
mediaConfig
;
ApplicationDomainEx
.
MediaConfig
=
mediaConfig
;
// Step
2
. 加载插件信息
// Step
3
. 加载插件信息
ApplicationDomainEx
.
PluginInfos
=
this
.
pluginService
.
LoadPluginInfos
();
ApplicationDomainEx
.
PluginInfos
=
this
.
pluginService
.
LoadPluginInfos
();
this
.
UpdatePluginInfos
(
vizConfig
);
this
.
UpdatePluginInfos
(
vizConfig
);
...
...
VIZ.Package.Module/Main/ViewModel/MainViewModel.cs
View file @
f33e1d02
...
@@ -220,7 +220,5 @@ namespace VIZ.Package.Module
...
@@ -220,7 +220,5 @@ namespace VIZ.Package.Module
return
path
;
return
path
;
}
}
}
}
}
}
VIZ.Package.Module/Page/Group/ViewModel/PageAddViewModel.cs
View file @
f33e1d02
...
@@ -122,13 +122,19 @@ namespace VIZ.Package.Module
...
@@ -122,13 +122,19 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
private
void
Loaded
()
private
void
Loaded
()
{
{
// 模板插件集合
this
.
TemplatePlugins
=
ApplicationDomainEx
.
PluginInfos
.
Where
(
this
.
TemplatePlugins
=
ApplicationDomainEx
.
PluginInfos
.
Where
(
p
=>
!
string
.
IsNullOrWhiteSpace
(
p
.
Group
)
&&
p
=>
!
string
.
IsNullOrWhiteSpace
(
p
.
Group
)
&&
p
.
Group
!=
ApplicationConstants
.
APPLICATION_GROUP_NAME
&&
p
.
Group
!=
ApplicationConstants
.
APPLICATION_GROUP_NAME
&&
p
.
Group
==
ApplicationDomainEx
.
VizConfig
.
PluginGroup
&&
p
.
Group
==
ApplicationDomainEx
.
VizConfig
.
PluginGroup
&&
p
.
PluginType
==
PluginType
.
Page
).
ToList
();
p
.
PluginType
==
PluginType
.
Page
).
ToList
();
// TODO: 选择默认模板
// 选择默认模板
PluginMapping
mapping
=
ApplicationDomainEx
.
PluginMappingConfig
?.
Mappings
?.
FirstOrDefault
(
p
=>
p
.
Scene
==
this
.
Scene
);
if
(
mapping
!=
null
)
{
this
.
SelectedTemplatePlugin
=
this
.
TemplatePlugins
.
FirstOrDefault
(
p
=>
p
.
ID
==
mapping
.
PluginID
);
}
}
}
#
endregion
#
endregion
...
...
VIZ.Package.Module/Plugin/View/PluginView.xaml
View file @
f33e1d02
...
@@ -17,6 +17,11 @@
...
@@ -17,6 +17,11 @@
d:DataContext="{d:DesignInstance Type=local:PluginViewModel}"
d:DataContext="{d:DesignInstance Type=local:PluginViewModel}"
mc:Ignorable="d"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<Grid>
<Grid>
<fcommon:NavigationControl ItemsSource="{Binding ItemsSource}"
<fcommon:NavigationControl ItemsSource="{Binding ItemsSource}"
SelectedValue="{Binding Path=SelectedValue,Mode=OneWay}"></fcommon:NavigationControl>
SelectedValue="{Binding Path=SelectedValue,Mode=OneWay}"></fcommon:NavigationControl>
...
...
VIZ.Package.Module/Plugin/ViewModel/PluginViewModel.cs
View file @
f33e1d02
using
DevExpress.Xpf.Printing
;
using
DevExpress.Xpf.Core.Native
;
using
DevExpress.Xpf.Printing
;
using
log4net
;
using
log4net
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
...
@@ -10,6 +11,7 @@ using VIZ.Framework.Common;
...
@@ -10,6 +11,7 @@ using VIZ.Framework.Common;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Plugin
;
using
VIZ.Package.Plugin
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Module
namespace
VIZ.Package.Module
{
{
...
@@ -25,6 +27,9 @@ namespace VIZ.Package.Module
...
@@ -25,6 +27,9 @@ namespace VIZ.Package.Module
public
PluginViewModel
()
public
PluginViewModel
()
{
{
// 初始化命令
this
.
InitCommand
();
// 初始化消息
// 初始化消息
this
.
InitMessage
();
this
.
InitMessage
();
...
@@ -33,6 +38,14 @@ namespace VIZ.Package.Module
...
@@ -33,6 +38,14 @@ namespace VIZ.Package.Module
}
}
/// <summary>
/// <summary>
/// 初始化命令
/// </summary>
private
void
InitCommand
()
{
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
}
/// <summary>
/// 初始化消息
/// 初始化消息
/// </summary>
/// </summary>
private
void
InitMessage
()
private
void
InitMessage
()
...
@@ -77,6 +90,39 @@ namespace VIZ.Package.Module
...
@@ -77,6 +90,39 @@ namespace VIZ.Package.Module
// Command
// Command
// ========================================================================
// ========================================================================
#
region
LoadedCommand
--
加载命令
/// <summary>
/// 加载命令
/// </summary>
public
VCommand
LoadedCommand
{
get
;
set
;
}
/// <summary>
/// 加载
/// </summary>
private
void
Loaded
()
{
if
(
this
.
IsAlreadyLoaded
)
return
;
// 获取插件映射配置
PluginMappingConfigEntity
config
=
ApplicationDomainEx
.
LocalDbContext
.
PluginMappingConfig
.
FindOne
(
p
=>
p
.
PluginGroup
==
ApplicationDomainEx
.
VizConfig
.
PluginGroup
);
if
(
config
==
null
)
{
config
=
new
PluginMappingConfigEntity
();
config
.
PluginGroup
=
ApplicationDomainEx
.
VizConfig
.
PluginGroup
;
config
.
Mappings
=
new
List
<
PluginMapping
>();
ApplicationDomainEx
.
LocalDbContext
.
PluginMappingConfig
.
Insert
(
config
);
}
ApplicationDomainEx
.
PluginMappingConfig
=
config
;
this
.
IsAlreadyLoaded
=
true
;
}
#
endregion
// ========================================================================
// ========================================================================
// Message
// Message
// ========================================================================
// ========================================================================
...
...
VIZ.Package.Module/Setting/PluginMapping/Model/PluginMappingModel.cs
0 → 100644
View file @
f33e1d02
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 插件映射模型
/// </summary>
public
class
PluginMappingModel
:
ModelBase
{
#
region
Scene
--
场景
private
string
scene
;
/// <summary>
/// 场景
/// </summary>
public
string
Scene
{
get
{
return
scene
;
}
set
{
scene
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Scene
));
}
}
#
endregion
#
region
PluginID
--
插件
ID
private
string
pluginID
;
/// <summary>
/// 插件ID
/// </summary>
public
string
PluginID
{
get
{
return
pluginID
;
}
set
{
pluginID
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
PluginID
));
}
}
#
endregion
}
}
VIZ.Package.Module/Setting/PluginMapping/PluginMappingSettingPluginLifeCycle.cs
0 → 100644
View file @
f33e1d02
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Plugin
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 插件映射插件生命周期
/// </summary>
public
class
PluginMappingSettingPluginLifeCycle
:
IPluginLifeCycle
{
/// <summary>
/// 插件分组
/// </summary>
public
const
string
PLUGIN_GROUP
=
ApplicationConstants
.
APPLICATION_GROUP_NAME
;
/// <summary>
/// 插件ID
/// </summary>
/// <remarks>
/// 插件ID不能包含点号
/// </remarks>
public
const
string
PLUGIN_ID
=
ModulePluginIds
.
PLUGIN_MAPPING_SETTING
;
/// <summary>
/// 插件名称
/// </summary>
public
const
string
PLUGIN_NAME
=
"插件映射"
;
/// <summary>
/// 注册
/// </summary>
/// <returns>插件信息</returns>
public
PluginInfo
Register
()
{
PluginInfo
info
=
new
PluginInfo
();
info
.
Group
=
PLUGIN_GROUP
;
info
.
ID
=
PLUGIN_ID
;
info
.
Name
=
PLUGIN_NAME
;
info
.
PluginType
=
PluginType
.
Setting
;
info
.
ViewType
=
typeof
(
PluginMappingSettingView
);
return
info
;
}
/// <summary>
/// 销毁
/// </summary>
public
void
Dispose
()
{
}
}
}
VIZ.Package.Module/Setting/PluginMapping/View/PluginMappingSettingView.xaml
0 → 100644
View file @
f33e1d02
<UserControl x:Class="VIZ.Package.Module.PluginMappingSettingView"
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:fcommon="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
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"
xmlns:domain="clr-namespace:VIZ.Package.Domain;assembly=VIZ.Package.Domain"
d:DataContext="{d:DesignInstance Type=local:PluginMappingSettingViewModel}"
d:Background="White"
mc:Ignorable="d"
d:DesignHeight="800" d:DesignWidth="800">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/IconButton/IconButton_Default.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<resource:RowHandleConverter x:Key="RowHandleConverter"></resource:RowHandleConverter>
</ResourceDictionary>
</UserControl.Resources>
<GroupBox Header="插件映射" Padding="10" Margin="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 按钮组 -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/add_32x32.png"
Width="40" ToolTip="添加"
Command="{Binding AddCommand}"
Style="{StaticResource IconButton_Menu_Mask}"></fcommon:IconButton>
<fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/delete_32x32.png"
Width="40" ToolTip="删除"
Command="{Binding DeleteCommand}"
Style="{StaticResource IconButton_Menu_Mask}"></fcommon:IconButton>
</StackPanel>
<!-- 列表 -->
<dxg:GridControl Grid.Row="1" ItemsSource="{Binding Path=Mappings}"
SelectedItem="{Binding Path=SelectedMapping,Mode=TwoWay}">
<dxg:GridControl.Columns>
<dxg:GridColumn Header="序号" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False" Width="40" AllowResizing="False">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<TextBlock Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Text="{Binding RowData.RowHandle,Converter={StaticResource RowHandleConverter}}"></TextBlock>
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="场景" FieldName="Scene" AllowSorting="False" AllowColumnFiltering="False" Width="120" AllowResizing="False">
<dxg:GridColumn.EditSettings>
<dxe:TextEditSettings AcceptsReturn="False"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="插件" FieldName="PluginID" AllowSorting="False" AllowColumnFiltering="False" Width="120" AllowResizing="False">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings ItemsSource="{Binding Path=PluginInfos}"
DisplayMember="Name" ValueMember="ID"></dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView IsColumnMenuEnabled="False"
AllowEditing="True" ShowIndicator="False"
NavigationStyle="Cell" ShowVerticalLines="False"
ShowGroupPanel="False" EditorShowMode="MouseUp"
AllowDragDrop="False"
ShowBandsPanel="False"
ShowTotalSummary="False"
ShowFixedTotalSummary="False"
ShowDragDropHint="False"
ShowTargetInfoInDragDropHint="false">
</dxg:TableView>
</dxg:GridControl.View>
</dxg:GridControl>
</Grid>
</GroupBox>
</UserControl>
\ No newline at end of file
VIZ.Package.Module/Setting/PluginMapping/View/PluginMappingSettingView.xaml.cs
0 → 100644
View file @
f33e1d02
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
;
using
VIZ.Package.Domain
;
namespace
VIZ.Package.Module
{
/// <summary>
/// PluginMappingSettingView.xaml 的交互逻辑
/// </summary>
public
partial
class
PluginMappingSettingView
:
UserControl
,
IPluginSettingView
{
public
PluginMappingSettingView
()
{
InitializeComponent
();
WPFHelper
.
BindingViewModel
(
this
,
new
PluginMappingSettingViewModel
());
}
/// <summary>
/// 保存
/// </summary>
public
void
Save
()
{
PluginMappingSettingViewModel
vm
=
this
.
DataContext
as
PluginMappingSettingViewModel
;
vm
.
Save
();
}
}
}
VIZ.Package.Module/Setting/PluginMapping/ViewModel/PluginMappingSettingViewModel.cs
0 → 100644
View file @
f33e1d02
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 插件映射设置视图模型
/// </summary>
public
class
PluginMappingSettingViewModel
:
ViewModelBase
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
PluginMappingSettingViewModel
));
/// <summary>
/// 媒资库配置设置视图模型
/// </summary>
public
PluginMappingSettingViewModel
()
{
// 初始化命令
this
.
InitCommand
();
}
/// <summary>
/// 初始化命令
/// </summary>
private
void
InitCommand
()
{
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
this
.
AddCommand
=
new
VCommand
(
this
.
Add
);
this
.
DeleteCommand
=
new
VCommand
(
this
.
Delete
);
}
// =========================================================================
// Property
// =========================================================================
#
region
Mappings
--
映射集合
private
ObservableCollection
<
PluginMappingModel
>
mappings
;
/// <summary>
/// 映射集合
/// </summary>
public
ObservableCollection
<
PluginMappingModel
>
Mappings
{
get
{
return
mappings
;
}
set
{
mappings
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Mappings
));
}
}
#
endregion
#
region
SelectedMapping
--
当前选中的映射
private
PluginMappingModel
selectedMapping
;
/// <summary>
/// 当前选中的映射
/// </summary>
public
PluginMappingModel
SelectedMapping
{
get
{
return
selectedMapping
;
}
set
{
selectedMapping
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
SelectedMapping
));
}
}
#
endregion
#
region
PluginInfos
--
插件信息集合
private
List
<
PluginInfo
>
pluginInfos
;
/// <summary>
/// 插件信息集合
/// </summary>
public
List
<
PluginInfo
>
PluginInfos
{
get
{
return
pluginInfos
;
}
set
{
pluginInfos
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
PluginInfos
));
}
}
#
endregion
// =========================================================================
// Command
// =========================================================================
#
region
LoadedCommand
--
加载命令
/// <summary>
/// 加载命令
/// </summary>
public
VCommand
LoadedCommand
{
get
;
set
;
}
/// <summary>
/// 加载
/// </summary>
private
void
Loaded
()
{
// 插件映射配置
PluginMappingConfigEntity
config
=
ApplicationDomainEx
.
PluginMappingConfig
;
ObservableCollection
<
PluginMappingModel
>
list
=
new
ObservableCollection
<
PluginMappingModel
>();
if
(
config
.
Mappings
!=
null
)
{
foreach
(
PluginMapping
item
in
config
.
Mappings
)
{
PluginMappingModel
model
=
new
PluginMappingModel
();
model
.
Scene
=
item
.
Scene
;
model
.
PluginID
=
item
.
PluginID
;
list
.
Add
(
model
);
}
}
this
.
Mappings
=
list
;
// 插件信息
this
.
PluginInfos
=
ApplicationDomainEx
.
PluginInfos
.
Where
(
p
=>
p
.
PluginType
==
PluginType
.
Page
&&
p
.
Group
!=
ApplicationConstants
.
APPLICATION_GROUP_NAME
).
ToList
();
}
#
endregion
#
region
AddCommand
--
添加命令
/// <summary>
/// 添加命令
/// </summary>
public
VCommand
AddCommand
{
get
;
set
;
}
/// <summary>
/// 添加
/// </summary>
private
void
Add
()
{
PluginMappingModel
model
=
new
PluginMappingModel
();
this
.
Mappings
.
Add
(
model
);
}
#
endregion
#
region
DeleteCommand
--
删除命令
/// <summary>
/// 删除命令
/// </summary>
public
VCommand
DeleteCommand
{
get
;
set
;
}
/// <summary>
/// 删除
/// </summary>
private
void
Delete
()
{
if
(
this
.
SelectedMapping
==
null
)
return
;
this
.
Mappings
.
Remove
(
this
.
SelectedMapping
);
}
#
endregion
// =========================================================================
// Public Function
// =========================================================================
/// <summary>
/// 保存
/// </summary>
public
void
Save
()
{
PluginMappingConfigEntity
config
=
ApplicationDomainEx
.
PluginMappingConfig
;
List
<
PluginMapping
>
list
=
new
List
<
PluginMapping
>();
if
(
this
.
Mappings
!=
null
)
{
foreach
(
PluginMappingModel
model
in
this
.
Mappings
)
{
PluginMapping
item
=
new
PluginMapping
();
item
.
Scene
=
model
.
Scene
;
item
.
PluginID
=
model
.
PluginID
;
list
.
Add
(
item
);
}
}
config
.
Mappings
=
list
;
ApplicationDomainEx
.
LocalDbContext
.
PluginMappingConfig
.
Update
(
config
);
}
}
}
\ No newline at end of file
VIZ.Package.Module/VIZ.Package.Module.csproj
View file @
f33e1d02
...
@@ -319,6 +319,12 @@
...
@@ -319,6 +319,12 @@
<DependentUpon>MediaSettingView.xaml</DependentUpon>
<DependentUpon>MediaSettingView.xaml</DependentUpon>
</Compile>
</Compile>
<Compile Include="Setting\Media\MediaSettingPluginLifeCycle.cs" />
<Compile Include="Setting\Media\MediaSettingPluginLifeCycle.cs" />
<Compile Include="Setting\PluginMapping\Model\PluginMappingModel.cs" />
<Compile Include="Setting\PluginMapping\PluginMappingSettingPluginLifeCycle.cs" />
<Compile Include="Setting\PluginMapping\ViewModel\PluginMappingSettingViewModel.cs" />
<Compile Include="Setting\PluginMapping\View\PluginMappingSettingView.xaml.cs">
<DependentUpon>PluginMappingSettingView.xaml</DependentUpon>
</Compile>
<Compile Include="Setting\VizConfig\VizConfigSettingPluginLifeCycle.cs" />
<Compile Include="Setting\VizConfig\VizConfigSettingPluginLifeCycle.cs" />
<Compile Include="Setting\VizConfig\ViewModel\VizConfigSettingViewModel.cs" />
<Compile Include="Setting\VizConfig\ViewModel\VizConfigSettingViewModel.cs" />
<Compile Include="Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="Setup\AppSetup_InitLiteDB.cs" />
...
@@ -553,6 +559,10 @@
...
@@ -553,6 +559,10 @@
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<SubType>Designer</SubType>
</Page>
</Page>
<Page Include="Setting\PluginMapping\View\PluginMappingSettingView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Task\PackageTask\View\PackageTaskView.xaml">
<Page Include="Task\PackageTask\View\PackageTaskView.xaml">
<Generator>MSBuild:Compile</Generator>
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
<SubType>Designer</SubType>
...
...
VIZ.Package.Storage/Entity/Config/PluginMappingConfigEntity.cs
0 → 100644
View file @
f33e1d02
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
PluginMapping
{
/// <summary>
/// 场景
/// </summary>
public
string
Scene
{
get
;
set
;
}
/// <summary>
/// 插件ID
/// </summary>
public
string
PluginID
{
get
;
set
;
}
}
/// <summary>
/// 插件映射配置
/// </summary>
public
class
PluginMappingConfigEntity
{
/// <summary>
/// 编号
/// </summary>
[
BsonId
(
true
)]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 插件分组
/// </summary>
public
string
PluginGroup
{
get
;
set
;
}
/// <summary>
/// 映射集合
/// </summary>
public
List
<
PluginMapping
>
Mappings
{
get
;
set
;
}
}
}
VIZ.Package.Storage/LocalDbContext.cs
View file @
f33e1d02
...
@@ -37,6 +37,7 @@ namespace VIZ.Package.Storage
...
@@ -37,6 +37,7 @@ namespace VIZ.Package.Storage
this
.
MediaConfig
=
this
.
Database
.
GetCollection
<
MediaConfigEntity
>();
this
.
MediaConfig
=
this
.
Database
.
GetCollection
<
MediaConfigEntity
>();
this
.
ConnGroup
=
this
.
Database
.
GetCollection
<
ConnGroupEntity
>();
this
.
ConnGroup
=
this
.
Database
.
GetCollection
<
ConnGroupEntity
>();
this
.
Conn
=
this
.
Database
.
GetCollection
<
ConnEntity
>();
this
.
Conn
=
this
.
Database
.
GetCollection
<
ConnEntity
>();
this
.
PluginMappingConfig
=
this
.
Database
.
GetCollection
<
PluginMappingConfigEntity
>();
}
}
/// <summary>
/// <summary>
...
@@ -65,6 +66,11 @@ namespace VIZ.Package.Storage
...
@@ -65,6 +66,11 @@ namespace VIZ.Package.Storage
public
ILiteCollection
<
ConnEntity
>
Conn
{
get
;
private
set
;
}
public
ILiteCollection
<
ConnEntity
>
Conn
{
get
;
private
set
;
}
/// <summary>
/// <summary>
/// 插件映射
/// </summary>
public
ILiteCollection
<
PluginMappingConfigEntity
>
PluginMappingConfig
{
get
;
private
set
;
}
/// <summary>
/// 销毁
/// 销毁
/// </summary>
/// </summary>
public
void
Dispose
()
public
void
Dispose
()
...
@@ -73,6 +79,7 @@ namespace VIZ.Package.Storage
...
@@ -73,6 +79,7 @@ namespace VIZ.Package.Storage
this
.
MediaConfig
=
null
;
this
.
MediaConfig
=
null
;
this
.
ConnGroup
=
null
;
this
.
ConnGroup
=
null
;
this
.
Conn
=
null
;
this
.
Conn
=
null
;
this
.
PluginMappingConfig
=
null
;
this
.
Database
?.
Dispose
();
this
.
Database
?.
Dispose
();
}
}
...
...
VIZ.Package.Storage/VIZ.Package.Storage.csproj
View file @
f33e1d02
...
@@ -68,6 +68,7 @@
...
@@ -68,6 +68,7 @@
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="Entity\Config\MediaConfigEntity.cs" />
<Compile Include="Entity\Config\MediaConfigEntity.cs" />
<Compile Include="Entity\Config\PluginMappingConfigEntity.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\ControlFieldEntity.cs" />
<Compile Include="Entity\ControlObject\ControlFieldEntity.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