Commit bd1be4c2 by liulongfei

插件配置文件

登录界面节目选择
parent 9ebdbbc0
ID,PluginID,Group,DisplayName,Type
1,1,CBA,CBA,Plugin
......@@ -102,6 +102,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -15,5 +15,10 @@ namespace VIZ.TVP.Domain
/// 项目文件后缀
/// </summary>
public const string PROJECT_FILE_SUFFIX = ".viz_tvp";
/// <summary>
/// VIZ层枚举
/// </summary>
public readonly static List<string> VIZ_LAYERS = new List<string> { "FRONT_LAYER", "MAIN_LAYER", "BACK_LAYER" };
}
}
......@@ -23,6 +23,11 @@ namespace VIZ.TVP.Domain
public LiteDbContext LiteDbContext { get; set; }
/// <summary>
/// CSV数据上下文
/// </summary>
public CsvContext CsvContext { get; set; }
/// <summary>
/// 销毁
/// </summary>
public void Dispose()
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Domain
{
/// <summary>
/// 插件配置模型
/// </summary>
public class PluginConfigModel : ModelBase
{
#region ID -- 编号
private string id;
/// <summary>
/// 编号
/// </summary>
public string ID
{
get { return id; }
set { id = value; this.RaisePropertyChanged(nameof(ID)); }
}
#endregion
#region PluginID -- 插件ID
private string pluginID;
/// <summary>
/// 插件ID
/// </summary>
public string PluginID
{
get { return pluginID; }
set { pluginID = value; this.RaisePropertyChanged(nameof(PluginID)); }
}
#endregion
#region Group -- 分组
private string group;
/// <summary>
/// 分组
/// </summary>
public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
#region DisplayName -- 显示名称
private string displayName;
/// <summary>
/// 显示名称
/// </summary>
public string DisplayName
{
get { return displayName; }
set { displayName = value; this.RaisePropertyChanged(nameof(DisplayName)); }
}
#endregion
#region Type -- 插件类型
private PluginTypeEnum type;
/// <summary>
/// 类型 Plguin | TemplatePlugin
/// </summary>
public PluginTypeEnum Type
{
get { return type; }
set { type = value; this.RaisePropertyChanged(nameof(Type)); }
}
#endregion
/// <summary>
/// 从配置文件中获取属性
/// </summary>
/// <param name="config">配置文件项</param>
public void PropertyFromConfig(PluginConfig config)
{
this.ID = config.ID;
this.PluginID = config.PluginID;
this.Group = config.Group;
this.DisplayName = config.DisplayName;
this.Type = config.Type;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
namespace VIZ.TVP.Domain
{
/// <summary>
/// 插件分组模型
/// </summary>
public class PluginGroupModel : ModelBase
{
#region Group -- 分组
private string group;
/// <summary>
/// 分组
/// </summary>
public string Group
{
get { return group; }
set { group = value; this.RaisePropertyChanged(nameof(Group)); }
}
#endregion
#region Items -- 插件项集合
private List<PluginConfigModel> items = new List<PluginConfigModel>();
/// <summary>
/// 插件项集合
/// </summary>
public List<PluginConfigModel> Items
{
get { return items; }
set { items = value; this.RaisePropertyChanged(nameof(Items)); }
}
#endregion
}
}
......@@ -179,6 +179,7 @@ namespace VIZ.TVP.Domain
this.TemplateID = this.Entity.TemplateID;
this.TemplateType = this.Entity.TemplateType;
this.SceneName = this.Entity.SceneName;
this.Path = this.Entity.Path;
this.Thumbnail = this.Entity.Thumbnail;
this.Remark = this.Entity.Remark;
this.Layer = this.Entity.Layer;
......@@ -194,6 +195,7 @@ namespace VIZ.TVP.Domain
this.Entity.TemplateID = this.TemplateID;
this.Entity.TemplateType = this.TemplateType;
this.Entity.SceneName = this.SceneName;
this.Entity.Path = this.Path;
this.Entity.Thumbnail = this.Thumbnail;
this.Entity.Remark = this.Remark;
this.Entity.Layer = this.Layer;
......
......@@ -12,6 +12,10 @@ namespace VIZ.TVP.Domain
public enum ResourceFileType
{
/// <summary>
/// 未指定
/// </summary>
None,
/// <summary>
/// 未知
/// </summary>
Unknow,
......
......@@ -82,6 +82,8 @@
<Compile Include="Message\Program\ProgramListItemChangedMessage.cs" />
<Compile Include="Message\Project\ProjectChangedMessage.cs" />
<Compile Include="Message\Project\ProjectSaveMessage.cs" />
<Compile Include="Model\Plugin\PluginConfigModel.cs" />
<Compile Include="Model\Plugin\PluginGroupModel.cs" />
<Compile Include="Model\Project\Program\ProgramListItemModel.cs" />
<Compile Include="Model\Project\Program\ProgramListModel.cs" />
<Compile Include="Model\Project\Program\ProgramTemplateModel.cs" />
......@@ -128,6 +130,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.TVP.Domain;
namespace VIZ.TVP.Module
{
......@@ -47,5 +48,10 @@ namespace VIZ.TVP.Module
/// 当前选择的引擎类型
/// </summary>
EnumModel SelectedLocalEngineType { get; set; }
/// <summary>
/// 选中的插件分组
/// </summary>
PluginGroupModel SelectedPluginGroup { get; set; }
}
}
......@@ -65,6 +65,7 @@ namespace VIZ.TVP.Module
info.VIZ_UserName = this.Support.VIZ_UserName;
info.VIZ_Password = this.Support.VIZ_Password;
info.LocalEngineType = (LocalEngineType)this.Support.SelectedLocalEngineType.Key;
info.PluginGroup = this.Support.SelectedPluginGroup?.Group;
ApplicationDomainEx.DataBaseManager.LiteDbContext.LocalInfo.Update(info);
......
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.TVP.Domain;
namespace VIZ.TVP.Module
{
......@@ -11,5 +12,14 @@ namespace VIZ.TVP.Module
/// </summary>
public interface IPluginSupport
{
/// <summary>
/// 插件分组集合
/// </summary>
List<PluginGroupModel> PluginGroups { get; set; }
/// <summary>
/// 选中的插件分组
/// </summary>
PluginGroupModel SelectedPluginGroup { get; set; }
}
}
......@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using VIZ.Framework.Plugin;
using VIZ.TVP.Domain;
using VIZ.TVP.Plugin;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
......@@ -45,6 +46,43 @@ namespace VIZ.TVP.Module
public IPluginSupport Support { get; private set; }
/// <summary>
/// 加载插件配置
/// </summary>
public void LoadPluginConfig()
{
Dictionary<string, PluginGroupModel> groupModels = new Dictionary<string, PluginGroupModel>();
foreach (var item in ApplicationDomainEx.DataBaseManager.CsvContext.PluginConfig)
{
if (!groupModels.TryGetValue(item.Group, out PluginGroupModel groupModel))
{
groupModel = new PluginGroupModel();
groupModel.Group = item.Group;
groupModels.Add(groupModel.Group, groupModel);
}
PluginConfigModel model = new PluginConfigModel();
model.PropertyFromConfig(item);
groupModel.Items.Add(model);
}
this.Support.PluginGroups = groupModels.Values.ToList();
LocalInfoEntity info = ApplicationDomainEx.DataBaseManager.LocalInfo;
if (string.IsNullOrWhiteSpace(info.PluginGroup))
{
this.Support.SelectedPluginGroup = this.Support.PluginGroups.FirstOrDefault();
}
else
{
this.Support.SelectedPluginGroup = this.Support.PluginGroups.FirstOrDefault(p => p.Group == info.PluginGroup) ?? this.Support.PluginGroups.FirstOrDefault();
}
}
/// <summary>
/// 加载插件
/// </summary>
public void LoadPlugins()
......@@ -52,8 +90,11 @@ namespace VIZ.TVP.Module
// 加载插件
this.executeLoadPlugins();
// 加载模板插件
this.executeLoadTemplatePlugins();
if (this.Support.SelectedPluginGroup != null)
{
// 加载外置插件
this.executeLoadFilePlugins();
}
}
/// <summary>
......@@ -88,12 +129,15 @@ namespace VIZ.TVP.Module
}
/// <summary>
/// 执行加载模板插件
/// 执行加载外置插件
/// </summary>
private void executeLoadTemplatePlugins()
private void executeLoadFilePlugins()
{
string[] files = System.IO.Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory);
Type templateLifeCycleType = typeof(ITemplatePluginLifeCycle);
Type pluginLifeCycleType = typeof(IPluginLifeCycle);
foreach (string file in files)
{
string fileName = System.IO.Path.GetFileName(file);
......@@ -105,25 +149,58 @@ namespace VIZ.TVP.Module
string version = assembly.GetCustomAttribute<AssemblyVersionAttribute>()?.Version;
Type[] types = assembly.GetTypes();
Type lifeCycleType = typeof(ITemplatePluginLifeCycle);
foreach (Type type in types)
{
if (!type.IsClass || !lifeCycleType.IsAssignableFrom(type))
if (!type.IsClass)
continue;
ITemplatePluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as ITemplatePluginLifeCycle;
if (lifeCycle == null)
// 模板插件
if (templateLifeCycleType.IsAssignableFrom(type))
{
log.Error($"init template plugin type: {type.FullName} error.");
ITemplatePluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as ITemplatePluginLifeCycle;
if (lifeCycle == null)
{
log.Error($"init template plugin type: {type.FullName} error.");
continue;
}
PluginInfo info = lifeCycle.Register();
if (!this.Support.SelectedPluginGroup.Items.Any(p => p.PluginID == info.ID && p.Type == PluginTypeEnum.TemplatePlugin))
{
continue;
}
info.LifeCycle = lifeCycle;
info.Version = version;
lifeCycle.Initialize();
ApplicationDomainEx.PluginManager.TemplatePlugins.Add(info);
continue;
}
PluginInfo info = lifeCycle.Register();
info.LifeCycle = lifeCycle;
info.Version = version;
lifeCycle.Initialize();
ApplicationDomainEx.PluginManager.TemplatePlugins.Add(info);
// 插件
if (pluginLifeCycleType.IsAssignableFrom(type))
{
IPluginLifeCycle lifeCycle = type.Assembly.CreateInstance(type.FullName) as IPluginLifeCycle;
if (lifeCycle == null)
{
log.Error($"init plugin type: {type.FullName} error.");
continue;
}
PluginInfo info = lifeCycle.Register();
if (!this.Support.SelectedPluginGroup.Items.Any(p => p.PluginID == info.ID && p.Type == PluginTypeEnum.Plugin))
{
continue;
}
info.LifeCycle = lifeCycle;
info.Version = version;
lifeCycle.Initialize();
ApplicationDomainEx.PluginManager.Plugins.Add(info);
continue;
}
}
}
}
......
......@@ -24,45 +24,56 @@
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!-- 节目 -->
<TextBlock Text="节目:" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Row="0" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=PluginGroups}"
SelectedItem="{Binding Path=SelectedPluginGroup,Mode=TwoWay}"
DisplayMember="Group">
</dxe:ComboBoxEdit>
<!-- 引擎 -->
<TextBlock Text="引擎:" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Column="1" Height="30" ItemsSource="{Binding Path=LocalEngineTypes}"
<TextBlock Text="引擎:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Row="1" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=LocalEngineTypes}"
SelectedItem="{Binding Path=SelectedLocalEngineType,Mode=TwoWay}"
DisplayMember="Description">
</dxe:ComboBoxEdit>
<!-- IP -->
<TextBlock Text="IP:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="1" Grid.Column="1" Height="30"
<TextBlock Text="IP:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30"
EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit>
<!-- 端口 -->
<TextBlock Text="端口:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30" MaskType="RegEx"
<TextBlock Text="端口:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30" MaskType="RegEx"
Mask="[0-9]{0,7}"
EditValue="{Binding GH_Port,Mode=TwoWay}"></dxe:TextEdit>
<!-- ServerName -->
<TextBlock Text="服务名:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30"
<TextBlock Text="服务名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="4" Grid.Column="1" Height="30"
EditValue="{Binding GH_ServerName,Mode=TwoWay}"></dxe:TextEdit>
<!-- UserName -->
<TextBlock Text="用户名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="4" Grid.Column="1" Height="30"
<TextBlock Text="用户名:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="5" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_UserName,Mode=TwoWay}"></dxe:TextEdit>
<!-- Password -->
<TextBlock Text="密码:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="5" Grid.Column="1" Height="30"
<TextBlock Text="密码:" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="6" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit>
<!-- 按钮组 -->
<Button Grid.Row="6" Width="120" Height="40" Grid.Column="1" Content="登录" HorizontalAlignment="Right"
<Button Grid.Row="7" Width="120" Height="40" Grid.Column="1" Content="登录" HorizontalAlignment="Right"
Command="{Binding Path=LoginCommand}"></Button>
</Grid>
......
......@@ -64,6 +64,35 @@ namespace VIZ.TVP.Module
// Property
// ==================================================================================
#region PluginGroups -- 插件分组集合
private List<PluginGroupModel> pluginGroups;
/// <summary>
/// 插件分组集合
/// </summary>
public List<PluginGroupModel> PluginGroups
{
get { return pluginGroups; }
set { pluginGroups = value; this.RaisePropertyChanged(nameof(PluginGroups)); }
}
#endregion
#region SelectedPluginGroup -- 选中的插件分组
private PluginGroupModel selectedPluginGroup;
/// <summary>
/// 选中的插件分组
/// </summary>
public PluginGroupModel SelectedPluginGroup
{
get { return selectedPluginGroup; }
set { selectedPluginGroup = value; this.RaisePropertyChanged(nameof(SelectedPluginGroup)); }
}
#endregion
#region GH_IP -- GH IP
private string gh_ip;
......@@ -214,6 +243,9 @@ namespace VIZ.TVP.Module
// 加载登录信息
this.loginController.LoadedLoginInfo();
// 加载插件配置信息
this.pluginController.LoadPluginConfig();
// 加载插件
this.pluginController.LoadPlugins();
......
......@@ -12,6 +12,7 @@
xmlns:storage="clr-namespace:VIZ.TVP.Storage;assembly=VIZ.TVP.Storage"
xmlns:resource="clr-namespace:VIZ.TVP.Module.Resource;assembly=VIZ.TVP.Module.Resource"
xmlns:local="clr-namespace:VIZ.TVP.Module"
xmlns:domain="clr-namespace:VIZ.TVP.Domain;assembly=VIZ.TVP.Domain"
d:DataContext="{d:DesignInstance Type=local:ProgramListViewModel}"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="800">
......@@ -66,7 +67,12 @@
<dxe:TextEditSettings TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLength="50"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="层" FieldName="Layer" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
<dxg:GridColumn Header="层" FieldName="Layer" AllowSorting="False" AllowColumnFiltering="False">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings ItemsSource="{Binding Source={x:Static domain:ApplicationConstants.VIZ_LAYERS}}"
IsTextEditable="False"></dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
......@@ -139,6 +145,7 @@
<MenuItem Header="重命名分组" Command="{Binding Path=PlacementTarget.DataContext.RenameGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<Separator></Separator>
<MenuItem Header="删除分组" Command="{Binding Path=PlacementTarget.DataContext.DeleteGroupCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
<MenuItem Header="删除节目单项" Command="{Binding Path=PlacementTarget.DataContext.DeleteItemCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</dx:DXTabControl.ContextMenu>
<dx:DXTabControl.View>
......@@ -183,7 +190,12 @@
<dxe:TextEditSettings TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLength="50"></dxe:TextEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="层" FieldName="Layer" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="false"></dxg:GridColumn>
<dxg:GridColumn Header="层" FieldName="Layer" AllowSorting="False" AllowColumnFiltering="false">
<dxg:GridColumn.EditSettings>
<dxe:ComboBoxEditSettings ItemsSource="{Binding Source={x:Static domain:ApplicationConstants.VIZ_LAYERS}}"
IsTextEditable="False"></dxe:ComboBoxEditSettings>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="引擎类型" FieldName="EngineType" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"></dxg:GridColumn>
<dxg:GridColumn Header="模板类型" ReadOnly="True" AllowSorting="False" AllowColumnFiltering="False"
Binding="{Binding Path=TemplateType,Converter={StaticResource Enum2EnumDescriptionConverter}}">
......
......@@ -12,6 +12,7 @@ using VIZ.Framework.Core;
using VIZ.Framework.Plugin;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
using VIZ.TVP.Storage;
namespace VIZ.TVP.Module
{
......@@ -42,6 +43,7 @@ namespace VIZ.TVP.Module
this.AddGroupCommand = new VCommand(this.AddGroup);
this.RenameGroupCommand = new VCommand(this.RenameGroup);
this.DeleteGroupCommand = new VCommand(this.DeleteGroup);
this.DeleteItemCommand = new VCommand(this.DeleteItem);
this.SceneTemplateAddToListCommand = new VCommand(this.SceneTemplateAddToList);
this.OtherTemplateAddToListCommand = new VCommand(this.OtherTemplateAddToList);
this.SceneTemplateUpdateCommand = new VCommand(this.SceneTemplateUpdate);
......@@ -312,6 +314,27 @@ namespace VIZ.TVP.Module
#endregion
#region DeleteItemCommand -- 删除分组项命令
/// <summary>
/// 删除分组项命令
/// </summary>
public VCommand DeleteItemCommand { get; set; }
/// <summary>
/// 删除分组项
/// </summary>
private void DeleteItem()
{
if (this.SelectedProgramListModel == null || this.SelectedProgramListModel.SelectedItem == null)
return;
this.SelectedProgramListModel.Items.Remove(this.SelectedProgramListModel.SelectedItem);
this.SelectedProgramListModel.SelectedItem = null;
}
#endregion
#region SceneTemplateAddToListCommand -- 场景模板添加至节目单命令
/// <summary>
......@@ -570,6 +593,7 @@ namespace VIZ.TVP.Module
model.TemplateID = Guid.NewGuid().ToString();
model.SceneName = fileModel.Name;
model.Path = fileModel.Path;
model.Layer = VizLayerEnum.MAIN_LAYER.ToString();
model.TemplateType = Storage.ProgramTemplateType.Scene;
model.Thumbnail = fileModel.Thumbnail;
model.ThumbnailBitmap = fileModel.ThumbnailBitmap;
......
......@@ -32,8 +32,12 @@
<ColumnDefinition Width="*" MinWidth="240" MaxWidth="400"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 资源文件夹 -->
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,6,0"
<dxg:TreeViewControl ItemsSource="{Binding Path=FolderModels}" Margin="0,0,6,0" Grid.Row="1"
SelectedItem="{Binding Path=SelectedFolderModel,Mode=TwoWay}"
SelectionMode="Row" ShowNodeImages="True" ShowSearchPanel="False"
ExpandStateFieldName="IsExpand"
......@@ -53,12 +57,35 @@
</dxg:TreeViewControl>
<!-- 文件夹等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Margin="0,0,6,0" />
<GridSplitter HorizontalAlignment="Right" Width="4"></GridSplitter>
<dx:WaitIndicator DeferedVisibility="{Binding IsFolderLoading}" Content="Loading..." Grid.Row="1" Margin="0,0,6,0" />
<GridSplitter HorizontalAlignment="Right" Width="4" Grid.Row="1"></GridSplitter>
<!-- 资源文件 -->
<dxg:GridControl Grid.Column="1" ShowBorder="False"
ItemsSource="{Binding Path=FileModels}"
<StackPanel Grid.Column="1" Orientation="Horizontal">
<RadioButton Height="30" Width="60" Content="All" IsChecked="True">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.None}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Height="30" Width="60" Content="场景">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.SCENE}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Height="30" Width="60" Content="图片">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.IMAGE}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
<RadioButton Height="30" Width="60" Content="视频">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="Checked" Command="{Binding Path=FileFilterCommand}" CommandParameter="{x:Static Member=domain:ResourceFileType.Video}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
</RadioButton>
</StackPanel>
<dxg:GridControl x:Name="fileGrid" Grid.Column="1" ShowBorder="False" Grid.Row="1"
CustomRowFilterCommand="{Binding Path=FileRowFilterCommand}"
ItemsSource="{Binding Path=FileModels}"
SelectedItem="{Binding Path=SelectedFileModel,Mode=TwoWay}">
<dxg:GridControl.Resources>
<!-- 定义Card模板 -->
......@@ -107,6 +134,6 @@
</dxg:GridControl>
<!-- 文件等待 -->
<dx:WaitIndicator DeferedVisibility="{Binding IsFileLoading}" Content="Loading..." Grid.Column="1" />
<dx:WaitIndicator DeferedVisibility="{Binding IsFileLoading}" Content="Loading..." Grid.Column="1" Grid.Row="1" />
</Grid>
</UserControl>
using DevExpress.Mvvm.POCO;
using DevExpress.Mvvm.UI.Native.ViewGenerator;
using DevExpress.Mvvm.Xpf;
using DevExpress.Xpf.Core.Native;
using log4net;
using System;
......@@ -44,6 +45,8 @@ namespace VIZ.TVP.Module
this.RefreshFolderCommand = new VCommand(this.RefreshFolder);
this.RefreshFileCommand = new VCommand(this.RefreshFile);
this.FolderExpandCommand = new VCommand<DevExpress.Xpf.Grid.TreeList.NodeDoubleClickEventArgs>(this.FolderExpand);
this.FileFilterCommand = new VCommand<ResourceFileType>(this.FileFilter);
this.FileRowFilterCommand = new DevExpress.Mvvm.DelegateCommand<RowFilterArgs>(this.FileRowFilter);
this.FileContextMenuOpendCommand = new VCommand(this.FileContextMenuOpend);
this.AddProgramTemplateCommand = new VCommand(this.AddProgramTemplate, this.CanAddProgramTemplate);
......@@ -151,6 +154,20 @@ namespace VIZ.TVP.Module
#endregion
#region FilterResourceFileType -- 资源文件类型
private ResourceFileType filterResourceFileType;
/// <summary>
/// 资源文件类型
/// </summary>
public ResourceFileType FilterResourceFileType
{
get { return filterResourceFileType; }
set { filterResourceFileType = value; this.RaisePropertySaveChanged(nameof(FilterResourceFileType)); }
}
#endregion
// ==================================================================================
// Service & Controller
// ==================================================================================
......@@ -279,6 +296,30 @@ namespace VIZ.TVP.Module
#endregion
#region FileFilterCommand -- 文件过滤命令
/// <summary>
/// 文件过滤命令
/// </summary>
public VCommand<ResourceFileType> FileFilterCommand { get; set; }
/// <summary>
/// 文件过滤
/// </summary>
/// <param name="type"></param>
private void FileFilter(ResourceFileType type)
{
this.FilterResourceFileType = type;
VizResourceView view = this.GetView<VizResourceView>();
if (view == null)
return;
view.fileGrid.RefreshData();
}
#endregion
#region FileContextMenuOpendCommand -- 文件右键菜单打开命令
/// <summary>
......@@ -329,6 +370,37 @@ namespace VIZ.TVP.Module
#endregion
#region FileRowFilterCommand -- 文件行筛选命令
/// <summary>
/// 文件行筛选命令, 该命令必须使用Dev的命令基类
/// </summary>
public DevExpress.Mvvm.DelegateCommand<RowFilterArgs> FileRowFilterCommand { get; set; }
/// <summary>
/// 文件行筛选
/// </summary>
/// <param name="e">赛选参数</param>
private void FileRowFilter(RowFilterArgs e)
{
GHResourceFileModel fileModel = e.Item as GHResourceFileModel;
if (fileModel == null)
{
e.Visible = false;
return;
}
if (this.FilterResourceFileType == ResourceFileType.None)
{
e.Visible = true;
return;
}
e.Visible = fileModel.FileType == this.FilterResourceFileType;
}
#endregion
// ==================================================================================
// Public Function
// ==================================================================================
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using log4net;
using VIZ.Framework.Core;
using VIZ.Framework.Domain;
using VIZ.Framework.Connection;
using VIZ.Framework.Storage;
using VIZ.Framework.Module;
using VIZ.TVP.Domain;
using VIZ.TVP.Service;
namespace VIZ.TVP.Module
{
/// <summary>
/// 应用程序启动 -- 初始化CSV
/// </summary>
public class AppSetup_InitCSV : AppSetupBase
{
/// <summary>
/// 日志
/// </summary>
private static ILog log = LogManager.GetLogger(typeof(AppSetup_InitCSV));
/// <summary>
/// 描述
/// </summary>
public override string Detail { get; } = "应用程序启动 -- 初始化CSV";
/// <summary>
/// 执行启动
/// </summary>
/// <param name="context">应用程序启动上下文</param>
/// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context)
{
ApplicationDomainEx.DataBaseManager.CsvContext = new Storage.CsvContext();
// 加载插件配置
this.LoadPluginConfig();
return true;
}
/// <summary>
/// 加载插件配置
/// </summary>
private void LoadPluginConfig()
{
string folder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config");
if (!System.IO.Directory.Exists(folder))
{
System.IO.Directory.CreateDirectory(folder);
}
string path = System.IO.Path.Combine(folder, "plugin_config.csv");
ApplicationDomainEx.DataBaseManager.CsvContext.LoadPluginConfig(path);
}
/// <summary>
/// 执行关闭
/// </summary>
/// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context)
{
}
}
}
......@@ -275,6 +275,7 @@
<Compile Include="Setting\View\SettingView.xaml.cs">
<DependentUpon>SettingView.xaml</DependentUpon>
</Compile>
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="Common\View\TextInputView.xaml.cs">
<DependentUpon>TextInputView.xaml</DependentUpon>
......
......@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -81,6 +81,7 @@
<Compile Include="VIZ\Interface\IVizCommandService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
using CsvHelper;
using log4net;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Storage;
namespace VIZ.TVP.Storage
{
/// <summary>
/// CSV上下文
/// </summary>
public class CsvContext
{
/// <summary>
/// 日志
/// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(CsvContext));
/// <summary>
/// 插件配置
/// </summary>
[Csv(Scene = CsvScene.Read)]
public List<PluginConfig> PluginConfig { get; private set; }
/// <summary>
/// 加载插件配置
/// </summary>
/// <param name="path">文件路径</param>
public void LoadPluginConfig(string path)
{
using (StreamReader sr = new StreamReader(path, Encoding.Default))
using (CsvReader reader = new CsvReader(sr, CultureInfo.InvariantCulture))
{
this.PluginConfig = reader.GetRecords<PluginConfig>()?.ToList();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 插件类型
/// </summary>
public enum PluginTypeEnum
{
/// <summary>
/// 普通插件
/// </summary>
Plugin,
/// <summary>
/// 模板插件
/// </summary>
TemplatePlugin
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.TVP.Storage
{
/// <summary>
/// 插件配置
/// </summary>
public class PluginConfig
{
/// <summary>
/// 编号
/// </summary>
public string ID { get; set; }
/// <summary>
/// 插件ID
/// </summary>
public string PluginID { get; set; }
/// <summary>
/// 分组
/// </summary>
public string Group { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 类型
/// </summary>
public PluginTypeEnum Type { get; set; }
}
}
......@@ -76,5 +76,10 @@ namespace VIZ.TVP.Storage
/// VIZ 引擎4路径
/// </summary>
public string VIZ_Eng4Path { get; set; } = @"D:\Program Files (x86)\Vizrt\Viz3\viz.exe";
/// <summary>
/// 插件分组
/// </summary>
public string PluginGroup { get; set; }
}
}
......@@ -49,18 +49,43 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<Reference Include="CsvHelper, Version=30.0.0.0, Culture=neutral, PublicKeyToken=8c4959082be5c823, processorArchitecture=MSIL">
<HintPath>..\packages\CsvHelper.30.0.1\lib\net47\CsvHelper.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.13.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.13\lib\net45\LiteDB.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=2.0.14.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.14\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.HashCode, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.HashCode.1.0.0\lib\net461\Microsoft.Bcl.HashCode.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.0\lib\netstandard2.0\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.4.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
......@@ -70,6 +95,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CSV\CsvContext.cs" />
<Compile Include="CSV\Plugin\Enum\PluginTypeEnum.cs" />
<Compile Include="CSV\Plugin\PluginConfig.cs" />
<Compile Include="LiteDB\Application\LocalInfo\Enum\LocalEngineType.cs" />
<Compile Include="LiteDB\Application\LocalInfo\LocalInfoEntity.cs" />
<Compile Include="LiteDB\Application\TVPConnection\Enum\TVPEngineType.cs" />
......@@ -110,6 +138,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CsvHelper" version="30.0.1" targetFramework="net48" />
<package id="LiteDB" version="5.0.13" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.0.0" targetFramework="net48" />
<package id="Microsoft.Bcl.HashCode" version="1.0.0" targetFramework="net48" />
<package id="Microsoft.CSharp" version="4.3.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
<package id="System.Buffers" version="4.4.0" targetFramework="net48" />
<package id="System.Memory" version="4.5.0" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.4.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net48" />
</packages>
\ No newline at end of file
......@@ -6,6 +6,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -7,6 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "00-Doc", "00-Doc", "{751737
ProjectSection(SolutionItems) = preProject
Doc\GH资源接口返回结果_文件.xml = Doc\GH资源接口返回结果_文件.xml
Doc\GH资源接口返回结果_文件夹或项目.xml = Doc\GH资源接口返回结果_文件夹或项目.xml
Doc\plugin_config.csv = Doc\plugin_config.csv
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-Lib", "05-Lib", "{39CED10E-394F-46A3-8571-948E126F9EC2}"
......
......@@ -9,6 +9,10 @@
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
\ No newline at end of file
......@@ -23,8 +23,10 @@ namespace VIZ.TVP
// 设置DevExpress主推
ApplicationThemeHelper.ApplicationThemeName = Theme.VS2019DarkName;
// TODO: AppSetup
// 初始化LiteDB
AppSetup.AppendSetup(new AppSetup_InitLiteDB());
// 初始化CSV
AppSetup.AppendSetup(new AppSetup_InitCSV());
// 执行启动流程
AppSetupContext context = AppSetup.Setup();
......
......@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:module="clr-namespace:VIZ.TVP.Module;assembly=VIZ.TVP.Module"
Title="咪咕播控系统" Height="420" Width="500" WindowStartupLocation="CenterScreen"
Title="咪咕播控系统" Height="480" Width="500" WindowStartupLocation="CenterScreen"
WindowStyle="SingleBorderWindow">
<Grid>
......
......@@ -122,6 +122,9 @@
<None Include="config\log.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="config\plugin_config.csv">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
ID,PluginID,Group,DisplayName,Type
1,1,CBA,CBA,Plugin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment