Commit 92280c83 by liulongfei

添加预览模式

parent 44b21b4a
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Domain
{
/// <summary>
/// 热键支持
/// </summary>
public interface IHotkeySupport
{
/// <summary>
/// 执行热键
/// </summary>
/// <param name="key">热键</param>
void ExecuteHotkey(string key);
}
}
...@@ -77,6 +77,7 @@ ...@@ -77,6 +77,7 @@
<Compile Include="ApplicationDomainEx.cs" /> <Compile Include="ApplicationDomainEx.cs" />
<Compile Include="Core\GridColumnControlFieldDefinition.cs" /> <Compile Include="Core\GridColumnControlFieldDefinition.cs" />
<Compile Include="Core\GridColumnDefinition.cs" /> <Compile Include="Core\GridColumnDefinition.cs" />
<Compile Include="Core\IHotkeySupport.cs" />
<Compile Include="Enum\ConnGroupStatus.cs" /> <Compile Include="Enum\ConnGroupStatus.cs" />
<Compile Include="Enum\ModulePluginIds.cs" /> <Compile Include="Enum\ModulePluginIds.cs" />
<Compile Include="Enum\ViewServiceKeys.cs" /> <Compile Include="Enum\ViewServiceKeys.cs" />
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
<RowDefinition Height="45"></RowDefinition> <RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition> <RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition> <RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="45"></RowDefinition>
<RowDefinition Height="55"></RowDefinition> <RowDefinition Height="55"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
...@@ -56,35 +57,43 @@ ...@@ -56,35 +57,43 @@
DisplayMember="Description"> DisplayMember="Description">
</dxe:ComboBoxEdit> </dxe:ComboBoxEdit>
<!-- 节目 --> <!-- 引擎模式 -->
<TextBlock Text="节目:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <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" <dxe:ComboBoxEdit Grid.Row="1" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=EnginePreviewModes}"
SelectedItem="{Binding Path=SelectedEnginePreviewMode,Mode=TwoWay}"
DisplayMember="Description">
</dxe:ComboBoxEdit>
<!-- 节目 -->
<TextBlock Text="节目:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Row="2" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=PluginGroups}" ItemsSource="{Binding Path=PluginGroups}"
SelectedItem="{Binding Path=SelectedPluginGroup,Mode=TwoWay}"> SelectedItem="{Binding Path=SelectedPluginGroup,Mode=TwoWay}">
</dxe:ComboBoxEdit> </dxe:ComboBoxEdit>
<!-- IP --> <!-- IP -->
<TextBlock Text="IP:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="IP:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="2" Grid.Column="1" Height="30" <dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30"
EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit>
<!-- ServerName --> <!-- ServerName -->
<TextBlock Text="服务名:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="服务名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Row="3" Grid.Column="1" Height="30" IsTextEditable="False" <dxe:ComboBoxEdit Grid.Row="4" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=GH_ServerName_List}" ItemsSource="{Binding Path=GH_ServerName_List}"
SelectedItem="{Binding Path=GH_ServerName,Mode=TwoWay}"> SelectedItem="{Binding Path=GH_ServerName,Mode=TwoWay}">
</dxe:ComboBoxEdit> </dxe:ComboBoxEdit>
<!-- UserName --> <!-- UserName -->
<TextBlock Text="用户名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="用户名:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:ComboBoxEdit Grid.Row="4" Grid.Column="1" Height="30" IsTextEditable="False" <dxe:ComboBoxEdit Grid.Row="5" Grid.Column="1" Height="30" IsTextEditable="False"
ItemsSource="{Binding Path=VIZ_UserName_List}" ItemsSource="{Binding Path=VIZ_UserName_List}"
SelectedItem="{Binding Path=VIZ_UserName,Mode=TwoWay}"> SelectedItem="{Binding Path=VIZ_UserName,Mode=TwoWay}">
</dxe:ComboBoxEdit> </dxe:ComboBoxEdit>
<!-- Password --> <!-- Password -->
<TextBlock Text="密码:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock> <TextBlock Text="密码:" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
<dxe:TextEdit Grid.Row="5" Grid.Column="1" Height="30" <dxe:TextEdit Grid.Row="6" Grid.Column="1" Height="30"
EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit> EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit>
<!-- 按钮组 --> <!-- 按钮组 -->
......
...@@ -92,6 +92,34 @@ namespace VIZ.Package.Module ...@@ -92,6 +92,34 @@ namespace VIZ.Package.Module
#endregion #endregion
#region EnginePreviewModes -- 引擎预览模式集合
private List<EnumModel> enginePreviewModes = EnumHelper.GetEnumModels<EnginePreviewMode>();
/// <summary>
/// 引擎预览模式集合
/// </summary>
public List<EnumModel> EnginePreviewModes
{
get { return enginePreviewModes; }
set { enginePreviewModes = value; this.RaisePropertyChanged(nameof(EnginePreviewModes)); }
}
#endregion
#region SelectedEnginePreviewMode -- 选中的引擎预览模式
private EnumModel selectedEnginePreviewMode;
/// <summary>
/// 选中的引擎预览模式
/// </summary>
public EnumModel SelectedEnginePreviewMode
{
get { return selectedEnginePreviewMode; }
set { selectedEnginePreviewMode = value; this.RaisePropertyChanged(nameof(SelectedEnginePreviewMode)); }
}
#endregion
#region PluginGroups -- 插件分组 #region PluginGroups -- 插件分组
private List<string> pluginGroups; private List<string> pluginGroups;
...@@ -303,6 +331,7 @@ namespace VIZ.Package.Module ...@@ -303,6 +331,7 @@ namespace VIZ.Package.Module
this.VIZ_UserName = vizConfig.VIZ_UserName; this.VIZ_UserName = vizConfig.VIZ_UserName;
this.VIZ_Password = vizConfig.VIZ_Password; this.VIZ_Password = vizConfig.VIZ_Password;
this.SelectedEngineFullType = this.EngineFullTypes.FirstOrDefault(p => (EngineFullType)p.Key == vizConfig.EngineFullType); this.SelectedEngineFullType = this.EngineFullTypes.FirstOrDefault(p => (EngineFullType)p.Key == vizConfig.EngineFullType);
this.SelectedEnginePreviewMode = this.EnginePreviewModes.FirstOrDefault(p => (EnginePreviewMode)p.Key == vizConfig.EnginePreviewMode);
}); });
} }
...@@ -346,6 +375,7 @@ namespace VIZ.Package.Module ...@@ -346,6 +375,7 @@ namespace VIZ.Package.Module
vizConfig.VIZ_Password = this.VIZ_Password; vizConfig.VIZ_Password = this.VIZ_Password;
vizConfig.PluginGroup = this.SelectedPluginGroup; vizConfig.PluginGroup = this.SelectedPluginGroup;
vizConfig.EngineFullType = (EngineFullType)this.SelectedEngineFullType.Key; vizConfig.EngineFullType = (EngineFullType)this.SelectedEngineFullType.Key;
vizConfig.EnginePreviewMode = (EnginePreviewMode)this.SelectedEnginePreviewMode.Key;
ApplicationDomainEx.LocalDbContext.VizConfig.Upsert(vizConfig); ApplicationDomainEx.LocalDbContext.VizConfig.Upsert(vizConfig);
......
...@@ -24,6 +24,9 @@ namespace VIZ.Package.Module ...@@ -24,6 +24,9 @@ namespace VIZ.Package.Module
// 初始化消息 // 初始化消息
this.InitMessage(); this.InitMessage();
// 初始化热键
this.InitHotkey();
// 注册服务 // 注册服务
ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.MAIN_VIEW_SERVICE, this); ApplicationDomainEx.ServiceManager.AddService(ViewServiceKeys.MAIN_VIEW_SERVICE, this);
} }
...@@ -44,6 +47,14 @@ namespace VIZ.Package.Module ...@@ -44,6 +47,14 @@ namespace VIZ.Package.Module
ApplicationDomainEx.MessageManager.Register<ApplicationClosedMessage>(this, this.OnApplicationClosedMessage); ApplicationDomainEx.MessageManager.Register<ApplicationClosedMessage>(this, this.OnApplicationClosedMessage);
} }
/// <summary>
/// 初始化热键
/// </summary>
private void InitHotkey()
{
}
// ============================================================ // ============================================================
// Service & Controller // Service & Controller
// ============================================================ // ============================================================
......
...@@ -126,16 +126,25 @@ namespace VIZ.Package.Module ...@@ -126,16 +126,25 @@ namespace VIZ.Package.Module
} while (vizHandle == IntPtr.Zero); } while (vizHandle == IntPtr.Zero);
// Step 4. 启动完成 // Step 4. 启动完成
WPFHelper.BeginInvoke(() => this.BeginSendVizEngineReadlyMessage();
{ });
// 设置 }
ApplicationDomainEx.IsVizPreviewReadly = true;
// 发送引擎嵌入完成消息 /// <summary>
VizPreviewReadyMessage msg = new VizPreviewReadyMessage(); /// 发送Viz引擎准备完毕消息
ApplicationDomainEx.MessageManager.Send(msg); /// </summary>
}); public void BeginSendVizEngineReadlyMessage()
{
WPFHelper.BeginInvoke(() =>
{
// 设置
ApplicationDomainEx.IsVizPreviewReadly = true;
// 发送引擎嵌入完成消息
VizPreviewReadyMessage msg = new VizPreviewReadyMessage();
ApplicationDomainEx.MessageManager.Send(msg);
}); });
} }
} }
} }
\ No newline at end of file
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
<StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center"> <StackPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center">
<fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/preview_refresh_32x32.png" <fcommon:IconButton Icon="/VIZ.Package.Module.Resource;component/Icons/preview_refresh_32x32.png"
ToolTip="重启预览引擎" ToolTip="重启预览引擎"
IsEnabled="{Binding Path=IsVizPreviewRefreshEnabled}"
Style="{StaticResource IconButton_Menu_Mask}" Margin="0,0,40,0" Style="{StaticResource IconButton_Menu_Mask}" Margin="0,0,40,0"
IconWidth="16" IconHeight="16" Height="30" Width="30" IconWidth="16" IconHeight="16" Height="30" Width="30"
Command="{Binding Path=RestartPreviewCommand}"></fcommon:IconButton> Command="{Binding Path=RestartPreviewCommand}"></fcommon:IconButton>
......
...@@ -147,6 +147,20 @@ namespace VIZ.Package.Module ...@@ -147,6 +147,20 @@ namespace VIZ.Package.Module
#endregion #endregion
#region IsVizPreviewRefreshEnabled -- Viz预览刷新是否可用
private bool isVizPreviewRefreshEnabled;
/// <summary>
/// Viz预览刷新是否可用
/// </summary>
public bool IsVizPreviewRefreshEnabled
{
get { return isVizPreviewRefreshEnabled; }
set { isVizPreviewRefreshEnabled = value; this.RaisePropertyChanged(nameof(IsVizPreviewRefreshEnabled)); }
}
#endregion
// ================================================================================ // ================================================================================
// Controller & Service // Controller & Service
// ================================================================================ // ================================================================================
...@@ -193,6 +207,9 @@ namespace VIZ.Package.Module ...@@ -193,6 +207,9 @@ namespace VIZ.Package.Module
ApplicationDomainEx.IsVizPreviewReadly = false; ApplicationDomainEx.IsVizPreviewReadly = false;
this.IsVizPreviewReadly = false; this.IsVizPreviewReadly = false;
VizConfigEntity config = ApplicationDomainEx.VizConfig;
this.IsVizPreviewRefreshEnabled = config.EnginePreviewMode == EnginePreviewMode.Implant;
// 启动引擎嵌入线程 // 启动引擎嵌入线程
ThreadHelper.SafeRun(() => ThreadHelper.SafeRun(() =>
{ {
...@@ -232,6 +249,10 @@ namespace VIZ.Package.Module ...@@ -232,6 +249,10 @@ namespace VIZ.Package.Module
VizConfigEntity config = ApplicationDomainEx.VizConfig; VizConfigEntity config = ApplicationDomainEx.VizConfig;
ConnModel conn = ApplicationDomainEx.PreviewConn; ConnModel conn = ApplicationDomainEx.PreviewConn;
// 引擎预览模式不是嵌入模式则不处理
if (config.EnginePreviewMode != EnginePreviewMode.Implant)
return;
if (conn == null || !conn.IsConnected) if (conn == null || !conn.IsConnected)
return; return;
...@@ -562,6 +583,14 @@ namespace VIZ.Package.Module ...@@ -562,6 +583,14 @@ namespace VIZ.Package.Module
ApplicationDomainEx.PreviewConnGroup = connGroup; ApplicationDomainEx.PreviewConnGroup = connGroup;
ApplicationDomainEx.PreviewConn = conn; ApplicationDomainEx.PreviewConn = conn;
// 如果预览模式为其他模式则不嵌入预览引擎
if (vizConfig.EnginePreviewMode != EnginePreviewMode.Implant)
{
this.vizPreviewController.BeginSendVizEngineReadlyMessage();
return;
}
string path = null; string path = null;
switch (vizConfig.EngineFullType) switch (vizConfig.EngineFullType)
......
...@@ -60,6 +60,9 @@ ...@@ -60,6 +60,9 @@
<Reference Include="DevExpress.Xpf.Grid.v22.2, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.Xpf.Grid.v22.2, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.2.Core, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.Xpf.Grid.v22.2.Core, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.Xpf.Grid.v22.2.Extensions, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.Xpf.Grid.v22.2.Extensions, Version=22.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="Gma.System.MouseKeyHook, Version=5.6.130.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MouseKeyHook.5.6.0\lib\net40\Gma.System.MouseKeyHook.dll</HintPath>
</Reference>
<Reference Include="LiteDB, Version=5.0.15.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL"> <Reference Include="LiteDB, Version=5.0.15.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27, processorArchitecture=MSIL">
<HintPath>..\packages\LiteDB.5.0.15\lib\net45\LiteDB.dll</HintPath> <HintPath>..\packages\LiteDB.5.0.15\lib\net45\LiteDB.dll</HintPath>
</Reference> </Reference>
......
...@@ -2,5 +2,6 @@ ...@@ -2,5 +2,6 @@
<packages> <packages>
<package id="LiteDB" version="5.0.15" targetFramework="net48" /> <package id="LiteDB" version="5.0.15" targetFramework="net48" />
<package id="log4net" version="2.0.14" targetFramework="net48" /> <package id="log4net" version="2.0.14" targetFramework="net48" />
<package id="MouseKeyHook" version="5.6.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" /> <package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
</packages> </packages>
\ No newline at end of file
...@@ -87,5 +87,10 @@ namespace VIZ.Package.Storage ...@@ -87,5 +87,10 @@ namespace VIZ.Package.Storage
/// 当前打开的项目路径 /// 当前打开的项目路径
/// </summary> /// </summary>
public string ProjectPath { get; set; } public string ProjectPath { get; set; }
/// <summary>
/// 引擎预览模式
/// </summary>
public EnginePreviewMode EnginePreviewMode { get; set; } = EnginePreviewMode.Implant;
} }
} }
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VIZ.Package.Storage
{
/// <summary>
/// 引擎预览模式
/// </summary>
public enum EnginePreviewMode
{
/// <summary>
/// 嵌入引擎
/// </summary>
[Description("嵌入引擎")]
Implant,
/// <summary>
/// 其他引擎
/// </summary>
[Description("其他引擎")]
Other
}
}
...@@ -112,6 +112,7 @@ ...@@ -112,6 +112,7 @@
<Compile Include="Enum\VizControlFieldType.cs" /> <Compile Include="Enum\VizControlFieldType.cs" />
<Compile Include="Enum\VizControlObjectParameters.cs" /> <Compile Include="Enum\VizControlObjectParameters.cs" />
<Compile Include="Enum\VizLayer.cs" /> <Compile Include="Enum\VizLayer.cs" />
<Compile Include="Enum\EnginePreviewMode.cs" />
<Compile Include="Enum\VizScene.cs" /> <Compile Include="Enum\VizScene.cs" />
<Compile Include="Ini\VizConfig.cs" /> <Compile Include="Ini\VizConfig.cs" />
<Compile Include="LocalDbContext.cs" /> <Compile Include="LocalDbContext.cs" />
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core" xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:module="clr-namespace:VIZ.Package.Module;assembly=VIZ.Package.Module" xmlns:module="clr-namespace:VIZ.Package.Module;assembly=VIZ.Package.Module"
Title="摩羯座播控系统" Height="600" Width="500" ControlBoxButtonSet="Close,Minimize" Title="摩羯座播控系统" Height="650" Width="500" ControlBoxButtonSet="Close,Minimize"
ResizeMode="NoResize" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen" BorderBrush="Black"> WindowStartupLocation="CenterScreen" BorderBrush="Black">
......
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