Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.TVP
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.TVP
Commits
dd91b9b9
Commit
dd91b9b9
authored
Dec 09, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VIZ渲染引擎嵌入
parent
af87145b
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
591 additions
and
15 deletions
+591
-15
VIZ.TVP.Domain/Model/TVPConnection/ITVPEndpointManager.cs
+17
-0
VIZ.TVP.Domain/Model/TVPConnection/TVPConnectionGroupModel.cs
+4
-4
VIZ.TVP.Module/MainView/View/MainView.xaml
+1
-1
VIZ.TVP.Module/VIZ.TVP.Module.csproj
+13
-0
VIZ.TVP.Module/VizRender/Controller/VizController/IVizSupport.cs
+8
-1
VIZ.TVP.Module/VizRender/Controller/VizController/VizController.cs
+87
-1
VIZ.TVP.Module/VizRender/View/VizRenderForm.Designer.cs
+48
-0
VIZ.TVP.Module/VizRender/View/VizRenderForm.cs
+20
-0
VIZ.TVP.Module/VizRender/View/VizRenderForm.resx
+121
-0
VIZ.TVP.Module/VizRender/View/VizRenderHost.cs
+85
-0
VIZ.TVP.Module/VizRender/View/VizRenderView.xaml
+16
-1
VIZ.TVP.Module/VizRender/ViewModel/VizRenderViewModel.cs
+117
-1
VIZ.TVP.Module/VizResource/View/VizResourceView.xaml
+1
-1
VIZ.TVP.Storage/LiteDB/Application/LiteDbContext.cs
+7
-0
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/Enum/TVPEngineType.cs
+2
-2
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/TVPConnectionGroupEntity.cs
+2
-2
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/TVPEngineConfig.cs
+40
-0
VIZ.TVP.Storage/VIZ.TVP.Storage.csproj
+2
-1
No files found.
VIZ.TVP.Domain/Model/TVPConnection/ITVPEndpointManager.cs
View file @
dd91b9b9
...
@@ -11,5 +11,22 @@ namespace VIZ.TVP.Domain
...
@@ -11,5 +11,22 @@ namespace VIZ.TVP.Domain
/// </summary>
/// </summary>
public
interface
ITVPEndpointManager
:
IDisposable
public
interface
ITVPEndpointManager
:
IDisposable
{
{
/// <summary>
/// 连接
/// </summary>
/// <param name="remoteIP">远程IP</param>
/// <param name="remotePort">远程端口</param>
void
Connect
(
string
remoteIP
,
int
remotePort
);
/// <summary>
/// 断开连接
/// </summary>
void
Disconnect
();
/// <summary>
/// 发送消息
/// </summary>
/// <param name="message">消息</param>
void
Send
(
string
message
);
}
}
}
}
VIZ.TVP.Domain/Model/TVPConnection/TVPConnectionGroupModel.cs
View file @
dd91b9b9
...
@@ -56,13 +56,13 @@ namespace VIZ.TVP.Domain
...
@@ -56,13 +56,13 @@ namespace VIZ.TVP.Domain
#
endregion
#
endregion
#
region
Type
--
连接
类型
#
region
Type
--
引擎
类型
private
TVP
Connection
Type
type
;
private
TVP
Engine
Type
type
;
/// <summary>
/// <summary>
///
连接
类型
///
引擎
类型
/// </summary>
/// </summary>
public
TVP
Connection
Type
Type
public
TVP
Engine
Type
Type
{
{
get
{
return
type
;
}
get
{
return
type
;
}
set
{
type
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Type
));
}
set
{
type
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
Type
));
}
...
...
VIZ.TVP.Module/MainView/View/MainView.xaml
View file @
dd91b9b9
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
</Style>
</Style>
</UserControl.Resources>
</UserControl.Resources>
<dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop">
<dxdo:DockLayoutManager x:Name="dockLayoutManager" FloatingMode="Desktop"
EnableWin32Compatibility="True"
>
<dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup>
<dxdo:LayoutGroup ItemsSource="{Binding ItemsSource}"></dxdo:LayoutGroup>
</dxdo:DockLayoutManager>
</dxdo:DockLayoutManager>
</UserControl>
</UserControl>
VIZ.TVP.Module/VIZ.TVP.Module.csproj
View file @
dd91b9b9
...
@@ -69,6 +69,7 @@
...
@@ -69,6 +69,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Core" />
...
@@ -78,9 +79,11 @@
...
@@ -78,9 +79,11 @@
<Reference Include="System.Xaml">
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
</Reference>
<Reference Include="UIAutomationProvider" />
<Reference Include="WindowsBase" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Page Include="Debug\View\DebugWindow.xaml">
<Page Include="Debug\View\DebugWindow.xaml">
...
@@ -157,10 +160,17 @@
...
@@ -157,10 +160,17 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</Compile>
<Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" />
<Compile Include="VizRender\View\VizRenderForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="VizRender\View\VizRenderForm.Designer.cs">
<DependentUpon>VizRenderForm.cs</DependentUpon>
</Compile>
<Compile Include="VizRender\Controller\VizController\IVizSupport.cs" />
<Compile Include="VizRender\Controller\VizController\IVizSupport.cs" />
<Compile Include="VizRender\Controller\VizController\VizController.cs" />
<Compile Include="VizRender\Controller\VizController\VizController.cs" />
<Compile Include="VizRender\Model\VizConnectionModel.cs" />
<Compile Include="VizRender\Model\VizConnectionModel.cs" />
<Compile Include="VizRender\ViewModel\VizRenderViewModel.cs" />
<Compile Include="VizRender\ViewModel\VizRenderViewModel.cs" />
<Compile Include="VizRender\View\VizRenderHost.cs" />
<Compile Include="VizRender\VizRenderPluginLifeCycle.cs" />
<Compile Include="VizRender\VizRenderPluginLifeCycle.cs" />
<Compile Include="VizResource\Controller\VizResourceFile\IVizResourceFileSupport.cs" />
<Compile Include="VizResource\Controller\VizResourceFile\IVizResourceFileSupport.cs" />
<Compile Include="VizResource\Controller\VizResourceFile\VizResourceFileController.cs" />
<Compile Include="VizResource\Controller\VizResourceFile\VizResourceFileController.cs" />
...
@@ -177,6 +187,9 @@
...
@@ -177,6 +187,9 @@
<Generator>ResXFileCodeGenerator</Generator>
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</EmbeddedResource>
<EmbeddedResource Include="VizRender\View\VizRenderForm.resx">
<DependentUpon>VizRenderForm.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="app.config" />
<None Include="packages.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<None Include="Properties\Settings.settings">
...
...
VIZ.TVP.Module/VizRender/Controller/VizController/IVizSupport.cs
View file @
dd91b9b9
...
@@ -6,7 +6,14 @@ using System.Threading.Tasks;
...
@@ -6,7 +6,14 @@ using System.Threading.Tasks;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
internal
class
IVizSupport
/// <summary>
/// VIZ支持
/// </summary>
public
interface
IVizSupport
{
{
/// <summary>
/// 引擎是否准备完毕
/// </summary>
bool
IsEngineReady
{
get
;
set
;
}
}
}
}
}
VIZ.TVP.Module/VizRender/Controller/VizController/VizController.cs
View file @
dd91b9b9
using
System
;
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.TVP.Connection
;
using
VIZ.TVP.Domain
;
using
VIZ.TVP.Storage
;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
...
@@ -11,5 +17,85 @@ namespace VIZ.TVP.Module
...
@@ -11,5 +17,85 @@ namespace VIZ.TVP.Module
/// </summary>
/// </summary>
public
class
VizController
public
class
VizController
{
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
VizController
));
/// <summary>
/// VIZ控制器
/// </summary>
/// <param name="support">支持</param>
public
VizController
(
IVizSupport
support
)
{
this
.
Support
=
support
;
}
/// <summary>
/// 支持
/// </summary>
public
IVizSupport
Support
{
get
;
private
set
;
}
/// <summary>
/// VIZ进程
/// </summary>
public
Process
VizProcess
{
get
;
private
set
;
}
/// <summary>
/// VIZ渲染窗口
/// </summary>
public
VizRenderForm
VizRenderForm
{
get
;
private
set
;
}
/// <summary>
/// VIZ渲染窗口句柄
/// </summary>
public
IntPtr
VizRenderFormHandle
{
get
;
private
set
;
}
/// <summary>
/// 启动VIZ引擎
/// </summary>
/// <param name="config">引擎配置</param>
/// <param name="hWnd">渲染宿主句柄</param>
public
void
StartVizEngine
(
TVPEngineConfig
config
,
IntPtr
hWnd
,
int
width
,
int
height
)
{
this
.
Support
.
IsEngineReady
=
false
;
// Step 2. 创建窗口
this
.
VizRenderForm
=
new
VizRenderForm
();
this
.
VizRenderForm
.
Show
();
this
.
VizRenderFormHandle
=
this
.
VizRenderForm
.
Handle
;
VizRenderView
view
=
(
this
.
Support
as
VizRenderViewModel
).
GetView
<
VizRenderView
>();
view
.
host
.
VizRenderFormHandle
=
this
.
VizRenderFormHandle
;
ThreadHelper
.
SafeRun
(()
=>
{
// Step 1. 启动进程
this
.
VizProcess
=
new
Process
();
this
.
VizProcess
.
StartInfo
.
WorkingDirectory
=
System
.
IO
.
Path
.
GetDirectoryName
(
config
.
FullPath
);
this
.
VizProcess
.
StartInfo
.
FileName
=
System
.
IO
.
Path
.
GetFileName
(
config
.
FullPath
);
this
.
VizProcess
.
StartInfo
.
Arguments
=
" -o -P -db Guest:@localhost/VizDbServer:19396"
;
this
.
VizProcess
.
StartInfo
.
UseShellExecute
=
true
;
this
.
VizProcess
.
StartInfo
.
WindowStyle
=
ProcessWindowStyle
.
Normal
;
this
.
VizProcess
.
Start
();
// Step 2. 等待发送命令
TVPConnectionModel
connectionModel
=
new
TVPConnectionModel
();
connectionModel
.
ID
=
"test"
;
connectionModel
.
EndpointManager
=
new
VizEndpointManager
(
"test"
);
connectionModel
.
EndpointManager
.
Connect
(
"localhost"
,
6100
);
// Step 3. 发送渲染命令
string
cmd
=
$"RENDERER WINDOW_OPEN_ON_PARENT 0x
{
this
.
VizRenderFormHandle
.
ToString
(
"X6"
)}
{
width
}
{
height
}
ONAIR"
;
connectionModel
.
EndpointManager
.
Send
(
cmd
);
if
(
Win32Helper
.
SetParent
(
this
.
VizRenderFormHandle
,
hWnd
).
ToInt32
()
<=
0
)
{
log
.
Error
(
"viz render set parent error."
);
}
this
.
VizRenderForm
.
Left
=
0
;
this
.
VizRenderForm
.
Top
=
0
;
});
}
}
}
}
}
VIZ.TVP.Module/VizRender/View/VizRenderForm.Designer.cs
0 → 100644
View file @
dd91b9b9
namespace
VIZ.TVP.Module
{
partial
class
VizRenderForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
Windows
Form
Designer
generated
code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private
void
InitializeComponent
()
{
this
.
SuspendLayout
();
//
// VizRenderForm
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
800
,
450
);
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
None
;
this
.
Name
=
"VizRenderForm"
;
this
.
Text
=
"VizRenderForm"
;
this
.
ResumeLayout
(
false
);
}
#
endregion
}
}
\ No newline at end of file
VIZ.TVP.Module/VizRender/View/VizRenderForm.cs
0 → 100644
View file @
dd91b9b9
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
namespace
VIZ.TVP.Module
{
public
partial
class
VizRenderForm
:
Form
{
public
VizRenderForm
()
{
InitializeComponent
();
}
}
}
VIZ.TVP.Module/VizRender/View/VizRenderForm.resx
0 → 100644
View file @
dd91b9b9
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
VIZ.TVP.Module/VizRender/View/VizRenderHost.cs
0 → 100644
View file @
dd91b9b9
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.Forms.Integration
;
using
VIZ.Framework.Core
;
using
VIZ.TVP.Domain
;
namespace
VIZ.TVP.Module
{
/// <summary>
/// VIZ渲染容器
/// </summary>
public
class
VizRenderHost
:
Border
{
public
VizRenderHost
()
{
this
.
Loaded
+=
VizRenderHost_Loaded
;
}
/// <summary>
/// 获取容器句柄
/// </summary>
/// <returns>容器句柄</returns>
public
IntPtr
GetHostHandle
()
{
return
this
.
vizHost
.
Handle
;
}
/// <summary>
/// VIZ渲染窗口句柄
/// </summary>
public
IntPtr
VizRenderFormHandle
{
get
;
set
;
}
/// <summary>
/// 加载完成时触发
/// </summary>
private
void
VizRenderHost_Loaded
(
object
sender
,
System
.
Windows
.
RoutedEventArgs
e
)
{
ApplicationDomainEx
.
DelayManager
.
Wait
(
"VIZ.TVP.Module.VizRenderHost.VizRenderHost_Loaded"
,
2
,
()
=>
{
WPFHelper
.
BeginInvoke
(()
=>
{
//System.Drawing.Color bgColor = System.Drawing.Color.FromArgb(37, 37, 38);
System
.
Drawing
.
Color
bgColor
=
System
.
Drawing
.
Color
.
FromArgb
(
255
,
255
,
255
);
this
.
vizHost
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
vizHost
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
vizHost
.
BackColor
=
bgColor
;
this
.
windowsFormsHost
=
new
WindowsFormsHost
();
this
.
windowsFormsHost
.
Background
=
new
System
.
Windows
.
Media
.
SolidColorBrush
((
System
.
Windows
.
Media
.
Color
)
System
.
Windows
.
Media
.
ColorConverter
.
ConvertFromString
(
"#ff252526"
));
this
.
windowsFormsHost
.
Child
=
this
.
vizHost
;
this
.
windowsFormsHost
.
HorizontalAlignment
=
HorizontalAlignment
.
Stretch
;
this
.
windowsFormsHost
.
VerticalAlignment
=
VerticalAlignment
.
Stretch
;
this
.
Child
=
this
.
windowsFormsHost
;
IntPtr
hWind
=
this
.
vizHost
.
Handle
;
ApplicationDomainEx
.
LoopManager
.
Register
(
"VIZ.TVP.Module.VizRenderHost"
,
0.1
,
()
=>
{
IntPtr
vizWindow
=
Win32Helper
.
FindWindowEx
(
hWind
,
IntPtr
.
Zero
,
null
,
null
);
if
(
vizWindow
.
ToInt32
()
<=
0
)
{
Win32Helper
.
SetParent
(
this
.
VizRenderFormHandle
,
hWind
);
}
});
});
});
}
/// <summary>
/// WPF Winform 容器
/// </summary>
private
WindowsFormsHost
windowsFormsHost
;
/// <summary>
/// Viz 引擎容器
/// </summary>
private
System
.
Windows
.
Forms
.
Panel
vizHost
;
}
}
VIZ.TVP.Module/VizRender/View/VizRenderView.xaml
View file @
dd91b9b9
...
@@ -3,10 +3,25 @@
...
@@ -3,10 +3,25 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
xmlns:local="clr-namespace:VIZ.TVP.Module"
xmlns:local="clr-namespace:VIZ.TVP.Module"
d:DataContext="{d:DesignInstance Type=local:VizRenderViewModel}"
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>
<TextBlock Text="VIZ渲染" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="36" Foreground="Red"></TextBlock>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!-- 按钮组 -->
<Border Background="Red">
<Button Width="120" Height="30" Content="嵌入Viz" Command="{Binding Path=TestCommand}"></Button>
</Border>
<!-- VIZ引擎 -->
<local:VizRenderHost x:Name="host" Grid.Row="1"></local:VizRenderHost>
</Grid>
</Grid>
</UserControl>
</UserControl>
VIZ.TVP.Module/VizRender/ViewModel/VizRenderViewModel.cs
View file @
dd91b9b9
...
@@ -3,16 +3,132 @@ using System.Collections.Generic;
...
@@ -3,16 +3,132 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Framework.Plugin
;
using
VIZ.Framework.Plugin
;
using
VIZ.TVP.Connection
;
using
VIZ.TVP.Domain
;
using
VIZ.TVP.Storage
;
namespace
VIZ.TVP.Module
namespace
VIZ.TVP.Module
{
{
/// <summary>
/// <summary>
/// VIZ渲染视图模型
/// VIZ渲染视图模型
/// </summary>
/// </summary>
public
class
VizRenderViewModel
:
PluginViewModelBase
public
class
VizRenderViewModel
:
PluginViewModelBase
,
IVizSupport
{
{
public
VizRenderViewModel
()
{
// 初始化控制器
this
.
initController
();
// 初始化命令
this
.
initCommand
();
}
/// <summary>
/// 初始化命令
/// </summary>
private
void
initCommand
()
{
this
.
LoadedCommand
=
new
VCommand
(
this
.
Loaded
);
this
.
TestCommand
=
new
VCommand
(
this
.
Test
);
}
/// <summary>
/// 初始化控制器
/// </summary>
private
void
initController
()
{
this
.
vizController
=
new
VizController
(
this
);
}
// ================================================================================
// Property
// ================================================================================
#
region
IsEngineReady
--
引擎是否准备完毕
private
bool
isEngineReady
;
/// <summary>
/// 引擎是否准备完毕
/// </summary>
public
bool
IsEngineReady
{
get
{
return
isEngineReady
;
}
set
{
isEngineReady
=
value
;
this
.
RaisePropertyChanged
(
nameof
(
IsEngineReady
));
}
}
#
endregion
// ================================================================================
// Controller
// ================================================================================
/// <summary>
/// Viz控制器
/// </summary>
private
VizController
vizController
;
// ================================================================================
// Command
// ================================================================================
#
region
LoadedCommand
--
加载命令
/// <summary>
/// 加载命令
/// </summary>
public
VCommand
LoadedCommand
{
get
;
set
;
}
/// <summary>
/// 加载
/// </summary>
private
void
Loaded
()
{
if
(
this
.
IsAlreadyLoaded
)
return
;
VizRenderView
view
=
this
.
GetView
<
VizRenderView
>();
this
.
IsAlreadyLoaded
=
true
;
}
#
endregion
#
region
TestCommand
--
测试命令
/// <summary>
/// 测试命令
/// </summary>
public
VCommand
TestCommand
{
get
;
set
;
}
/// <summary>
/// 测试
/// </summary>
private
void
Test
()
{
VizRenderView
view
=
this
.
GetView
<
VizRenderView
>();
// --------------------------------------------------------------------
// 测试代码
// --------------------------------------------------------------------
TVPEngineConfig
config
=
new
TVPEngineConfig
();
config
.
Name
=
"测试VIZ引擎"
;
config
.
EngineType
=
TVPEngineType
.
VIZ
;
config
.
FullPath
=
@"D:\Program Files (x86)\Vizrt\Viz3\viz.exe"
;
// --------------------------------------------------------------------
this
.
vizController
.
StartVizEngine
(
config
,
view
.
host
.
GetHostHandle
(),
400
,
300
);
}
#
endregion
// ================================================================================
// Public Function
// ================================================================================
/// <summary>
/// <summary>
/// 销毁
/// 销毁
...
...
VIZ.TVP.Module/VizResource/View/VizResourceView.xaml
View file @
dd91b9b9
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:fcore="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
xmlns:local="clr-namespace:VIZ.TVP.Module"
xmlns:local="clr-namespace:VIZ.TVP.Module"
xmlns:domain="clr-namespace:VIZ.TVP.Domain;assembly=VIZ.TVP.Domain"
xmlns:domain="clr-namespace:VIZ.TVP.Domain;assembly=VIZ.TVP.Domain"
mc:Ignorable="d"
x:Name="uc"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=local:VizResourceViewModel}"
d:DataContext="{d:DesignInstance Type=local:VizResourceViewModel}"
d:DesignHeight="450" d:DesignWidth="800">
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<UserControl.Resources>
...
...
VIZ.TVP.Storage/LiteDB/Application/LiteDbContext.cs
View file @
dd91b9b9
...
@@ -36,6 +36,7 @@ namespace VIZ.TVP.Storage
...
@@ -36,6 +36,7 @@ namespace VIZ.TVP.Storage
// 包装连接
// 包装连接
this
.
TVPConnectionGroup
=
this
.
Database
.
GetCollection
<
TVPConnectionGroupEntity
>();
this
.
TVPConnectionGroup
=
this
.
Database
.
GetCollection
<
TVPConnectionGroupEntity
>();
this
.
TVPConnection
=
this
.
Database
.
GetCollection
<
TVPConnectionEntity
>();
this
.
TVPConnection
=
this
.
Database
.
GetCollection
<
TVPConnectionEntity
>();
this
.
TVPEngineConfig
=
this
.
Database
.
GetCollection
<
TVPEngineConfig
>();
}
}
/// <summary>
/// <summary>
...
@@ -58,12 +59,18 @@ namespace VIZ.TVP.Storage
...
@@ -58,12 +59,18 @@ namespace VIZ.TVP.Storage
public
ILiteCollection
<
TVPConnectionEntity
>
TVPConnection
{
get
;
private
set
;
}
public
ILiteCollection
<
TVPConnectionEntity
>
TVPConnection
{
get
;
private
set
;
}
/// <summary>
/// <summary>
/// 引擎配置
/// </summary>
public
ILiteCollection
<
TVPEngineConfig
>
TVPEngineConfig
{
get
;
private
set
;
}
/// <summary>
/// 销毁
/// 销毁
/// </summary>
/// </summary>
public
void
Dispose
()
public
void
Dispose
()
{
{
this
.
TVPConnectionGroup
=
null
;
this
.
TVPConnectionGroup
=
null
;
this
.
TVPConnection
=
null
;
this
.
TVPConnection
=
null
;
this
.
TVPEngineConfig
=
null
;
this
.
Database
?.
Dispose
();
this
.
Database
?.
Dispose
();
}
}
...
...
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/Enum/TVP
Connection
Type.cs
→
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/Enum/TVP
Engine
Type.cs
View file @
dd91b9b9
...
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
...
@@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace
VIZ.TVP.Storage
namespace
VIZ.TVP.Storage
{
{
/// <summary>
/// <summary>
/// 包装
连接
类型
/// 包装
引擎
类型
/// </summary>
/// </summary>
public
enum
TVP
Connection
Type
public
enum
TVP
Engine
Type
{
{
/// <summary>
/// <summary>
/// VIZ
/// VIZ
...
...
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/TVPConnectionGroupEntity.cs
View file @
dd91b9b9
...
@@ -23,8 +23,8 @@ namespace VIZ.TVP.Storage
...
@@ -23,8 +23,8 @@ namespace VIZ.TVP.Storage
public
string
DisplayName
{
get
;
set
;
}
public
string
DisplayName
{
get
;
set
;
}
/// <summary>
/// <summary>
///
连接
类型
///
引擎
类型
/// </summary>
/// </summary>
public
TVP
ConnectionType
Connection
Type
{
get
;
set
;
}
public
TVP
EngineType
Engine
Type
{
get
;
set
;
}
}
}
}
}
VIZ.TVP.Storage/LiteDB/Application/TVPConnection/TVPEngineConfig.cs
0 → 100644
View file @
dd91b9b9
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
VIZ.TVP.Storage
{
/// <summary>
/// 链接引擎配置
/// </summary>
public
class
TVPEngineConfig
{
/// <summary>
/// 编号
/// </summary>
[
LiteDB
.
BsonId
(
true
)]
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 连接类型
/// </summary>
public
TVPEngineType
EngineType
{
get
;
set
;
}
/// <summary>
/// 名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 进程完整路径
/// </summary>
public
string
FullPath
{
get
;
set
;
}
/// <summary>
/// 版本
/// </summary>
public
string
Version
{
get
;
set
;
}
}
}
VIZ.TVP.Storage/VIZ.TVP.Storage.csproj
View file @
dd91b9b9
...
@@ -70,10 +70,11 @@
...
@@ -70,10 +70,11 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="LiteDB\Application\TVPConnection\Enum\TVP
Connection
Type.cs" />
<Compile Include="LiteDB\Application\TVPConnection\Enum\TVP
Engine
Type.cs" />
<Compile Include="LiteDB\Application\TVPConnection\TVPConnectionEntity.cs" />
<Compile Include="LiteDB\Application\TVPConnection\TVPConnectionEntity.cs" />
<Compile Include="LiteDB\Application\LiteDbContext.cs" />
<Compile Include="LiteDB\Application\LiteDbContext.cs" />
<Compile Include="LiteDB\Application\TVPConnection\TVPConnectionGroupEntity.cs" />
<Compile Include="LiteDB\Application\TVPConnection\TVPConnectionGroupEntity.cs" />
<Compile Include="LiteDB\Application\TVPConnection\TVPEngineConfig.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XML\GH\Enum\GH_Category_Term_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Category_Term_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Content_Type_Enums.cs" />
<Compile Include="XML\GH\Enum\GH_Content_Type_Enums.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