Przeglądaj źródła

增加外挂模块

tanghai 13 lat temu
rodzic
commit
032d1808f4

+ 2 - 0
CSharp/App/Editor/Bootstrapper.cs

@@ -5,6 +5,7 @@ using Microsoft.Practices.Prism.MefExtensions;
 using Microsoft.Practices.Prism.Regions;
 using Modules.BehaviorTree;
 using Modules.Robot;
+using Modules.WaiGua;
 
 namespace Editor
 {
@@ -16,6 +17,7 @@ namespace Editor
 			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (ViewExportAttribute).Assembly));
 			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (BehaviorTreeModule).Assembly));
 			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (RobotModule).Assembly));
+			this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof (WaiGuaModule).Assembly));
 		}
 
 		protected override void InitializeShell()

+ 4 - 0
CSharp/App/Editor/Editor.csproj

@@ -125,6 +125,10 @@
       <Project>{5D6ECBCD-BE14-4DCB-BAEC-57089748B164}</Project>
       <Name>Robot</Name>
     </ProjectReference>
+    <ProjectReference Include="..\Modules\WaiGua\WaiGua.csproj">
+      <Project>{5AA48F9A-455D-4CD8-A605-A3AC38283E60}</Project>
+      <Name>WaiGua</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <None Include="app.config" />

+ 4 - 1
CSharp/App/Editor/Shell.xaml

@@ -10,6 +10,9 @@
 			<TabItem Height="25" Width="80" Header="机器人">
 				<ContentControl Name="robot" prism:RegionManager.RegionName="RobotRegion" />
 			</TabItem>
-		</TabControl>
+            <TabItem Height="25" Width="80" Header="外挂">
+                <ContentControl Name="waigua" prism:RegionManager.RegionName="WaiGuaRegion" />
+            </TabItem>
+        </TabControl>
 	</Grid>
 </Window>

+ 6 - 0
CSharp/App/Modules/WaiGua/Packages.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="CommonServiceLocator" version="1.0" targetFramework="net45" />
+  <package id="Prism" version="4.1.0.0" targetFramework="net45" />
+  <package id="Prism.MEFExtensions" version="4.1.0.0" targetFramework="net45" />
+</packages>

+ 6 - 0
CSharp/App/Modules/WaiGua/WaiGua.cs

@@ -0,0 +1,6 @@
+namespace Modules.WaiGua
+{
+	public class WaiGua
+	{
+	}
+}

+ 98 - 0
CSharp/App/Modules/WaiGua/WaiGua.csproj

@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{5AA48F9A-455D-4CD8-A605-A3AC38283E60}</ProjectGuid>
+    <OutputType>library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>WaiGua</RootNamespace>
+    <AssemblyName>WaiGua</AssemblyName>
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\</SolutionDir>
+    <RestorePackages>true</RestorePackages>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Expression.Interactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Prism.4.1.0.0\lib\NET40\Microsoft.Expression.Interactions.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Practices.Prism">
+      <HintPath>..\..\..\packages\Prism.4.1.0.0\lib\NET40\Microsoft.Practices.Prism.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Practices.Prism.MefExtensions">
+      <HintPath>..\..\..\packages\Prism.MEFExtensions.4.1.0.0\lib\NET40\Microsoft.Practices.Prism.MefExtensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.ComponentModel.Composition" />
+    <Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+      <HintPath>..\..\..\packages\Prism.4.1.0.0\lib\NET40\System.Windows.Interactivity.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="WaiGuaViewModel.cs" />
+    <Page Include="WaiGuaView.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="WaiGua.cs" />
+    <Compile Include="WaiGuaModule.cs" />
+    <Compile Include="WaiGuaView.xaml.cs">
+      <DependentUpon>WaiGuaView.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <ItemGroup>
+    <AppDesigner Include="Properties\" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\Platform\Infrastructure\Infrastructure.csproj">
+      <Project>{48A2E149-0DAC-41B4-BB54-DFBCCD6D42B3}</Project>
+      <Name>Infrastructure</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 13 - 0
CSharp/App/Modules/WaiGua/WaiGuaModule.cs

@@ -0,0 +1,13 @@
+using Microsoft.Practices.Prism.MefExtensions.Modularity;
+using Microsoft.Practices.Prism.Modularity;
+
+namespace Modules.WaiGua
+{
+	[ModuleExport(moduleType: typeof(WaiGuaModule))]
+	public class WaiGuaModule : IModule
+	{
+		public void Initialize()
+		{
+		}
+	}
+}

+ 15 - 0
CSharp/App/Modules/WaiGua/WaiGuaView.xaml

@@ -0,0 +1,15 @@
+<UserControl x:Class="Modules.WaiGua.WaiGuaView"
+             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:WaiGua="clr-namespace:Modules.WaiGua"
+             mc:Ignorable="d" 
+             d:DesignHeight="600" d:DesignWidth="800" 
+             d:DataContext="{d:DesignInstance WaiGua:WaiGuaViewModel}">
+    <Grid>
+        <StackPanel>
+            <Image Height="100"/>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 30 - 0
CSharp/App/Modules/WaiGua/WaiGuaView.xaml.cs

@@ -0,0 +1,30 @@
+using System.ComponentModel.Composition;
+using Infrastructure;
+
+namespace Modules.WaiGua
+{
+	/// <summary>
+	/// RobotView.xaml 的交互逻辑
+	/// </summary>
+	[ViewExport(RegionName = "WaiGuaRegion"), PartCreationPolicy(CreationPolicy.NonShared)]
+	public partial class WaiGuaView
+	{
+		public WaiGuaView()
+		{
+			this.InitializeComponent();
+		}
+
+		[Import]
+		private WaiGuaViewModel ViewModel
+		{
+			get
+			{
+				return this.DataContext as WaiGuaViewModel;
+			}
+			set
+			{
+				this.DataContext = value;
+			}
+		}
+	}
+}

+ 34 - 0
CSharp/App/Modules/WaiGua/WaiGuaViewModel.cs

@@ -0,0 +1,34 @@
+using System;
+using System.ComponentModel.Composition;
+using Microsoft.Practices.Prism.ViewModel;
+
+namespace Modules.WaiGua
+{
+	[Export(contractType: typeof(WaiGuaViewModel)), PartCreationPolicy(creationPolicy: CreationPolicy.NonShared)]
+	internal class WaiGuaViewModel : NotificationObject
+	{
+		private string logText = "";
+
+		public string LogText
+		{
+			get
+			{
+				return this.logText;
+			}
+			set
+			{
+				if (this.logText == value)
+				{
+					return;
+				}
+				this.logText = value;
+				this.RaisePropertyChanged("LogText");
+			}
+		}
+
+		public void Start()
+		{
+			this.LogText += "11111111111" + Environment.NewLine;
+		}
+	}
+}

+ 15 - 0
CSharp/CSharp.sln

@@ -35,6 +35,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENetSharp", "ThirdParty\ENe
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hooks", "Platform\Hooks\Hooks.csproj", "{3A98B35C-DEA8-489C-9203-263FFB6B065D}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WaiGua", "App\Modules\WaiGua\WaiGua.csproj", "{5AA48F9A-455D-4CD8-A605-A3AC38283E60}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -147,6 +149,18 @@ Global
 		{3A98B35C-DEA8-489C-9203-263FFB6B065D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
 		{3A98B35C-DEA8-489C-9203-263FFB6B065D}.Release|Win32.ActiveCfg = Release|Any CPU
 		{3A98B35C-DEA8-489C-9203-263FFB6B065D}.Release|x86.ActiveCfg = Release|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Release|Any CPU.Build.0 = Release|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Release|Win32.ActiveCfg = Release|Any CPU
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60}.Release|x86.ActiveCfg = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -159,6 +173,7 @@ Global
 		{3A98B35C-DEA8-489C-9203-263FFB6B065D} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
 		{6CD185D1-08E0-4729-A999-2D5B57BA8193} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{5D6ECBCD-BE14-4DCB-BAEC-57089748B164} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
+		{5AA48F9A-455D-4CD8-A605-A3AC38283E60} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
 		{C9992B7C-313E-4C9F-A954-640D01EDFB58} = {9173C593-D63F-49F6-AFA7-028425D13E4B}
 		{D0B4CFAC-A368-4742-9863-68776CFA9938} = {9173C593-D63F-49F6-AFA7-028425D13E4B}
 	EndGlobalSection