Commit c04197c8 几米阳光

添加wcf模块

1 个父辈 bdf72f89
...@@ -3,17 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00 ...@@ -3,17 +3,19 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.27130.2024 VisualStudioVersion = 15.0.27130.2024
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "..\ACSingleStore\source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACServoDriveTest", "source\ACServoDriveTest\ACServoDriveTest.csproj", "{7FA84E1E-BCDE-49F6-BE42-0BC397AF65B8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACSingleStore", "..\ACSingleStore\source\ACSingleStore\ACSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ACSingleStore", "source\ACSingleStore\ACSingleStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "..\ACSingleStore\source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Common.csproj", "{43CDD09E-FCF3-4960-A01D-3BBFE9933122}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "..\ACSingleStore\source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserFromControl", "..\ACSingleStore\source\UserFromControl\UserFromControl.csproj", "{F018462A-D9BC-4365-97F2-F6D71751641E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserFromControl", "source\UserFromControl\UserFromControl.csproj", "{F018462A-D9BC-4365-97F2-F6D71751641E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "..\ACSingleStore\source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AcStoreWCF", "AcStoreWCF\AcStoreWCF.csproj", "{BC133455-A1C9-4202-8489-16458C7FA5E5}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -45,6 +47,10 @@ Global ...@@ -45,6 +47,10 @@ Global
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.Build.0 = Debug|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.Build.0 = Debug|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.ActiveCfg = Release|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.ActiveCfg = Release|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.Build.0 = Release|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.Build.0 = Release|Any CPU
{BC133455-A1C9-4202-8489-16458C7FA5E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC133455-A1C9-4202-8489-16458C7FA5E5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC133455-A1C9-4202-8489-16458C7FA5E5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC133455-A1C9-4202-8489-16458C7FA5E5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
<Project ToolsVersion="15.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>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{BC133455-A1C9-4202-8489-16458C7FA5E5}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AcStoreWCF</RootNamespace>
<AssemblyName>AcStoreWCF</AssemblyName>
<ProjectTypeGuids>{3D9AD99F-2412-4246-B90B-4EAA41C64699};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<StartArguments>/client:"WcfTestClient.exe"</StartArguments>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<WcfConfigValidationEnabled>True</WcfConfigValidationEnabled>
<XsdCodeGenEnabled>True</XsdCodeGenEnabled>
<TargetFrameworkProfile />
</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="log4net">
<HintPath>..\dll\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="ICWSMDBox.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CWSMDBox.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\source\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<VSToolsPath Condition="'$(VSToolsPath)' == '' and '$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' != '11.0'">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio</VSToolsPath>
<WcfServiceModelTargetPath>$(VSToolsPath)\WCF</WcfServiceModelTargetPath>
</PropertyGroup>
<Import Project="$(WcfServiceModelTargetPath)\Microsoft.VisualStudio.ServiceModel.targets" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{3D9AD99F-2412-4246-B90B-4EAA41C64699}">
<WcfProjectProperties>
<AutoStart>True</AutoStart>
</WcfProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<!-- 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>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<system.web>
<compilation debug="true"/>
</system.web>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 --><!--
<system.serviceModel>
<services>
<service name="AcStoreWCF.CWSMDBox">
<endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/SMDBox/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
--><!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false --><!--
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
--><!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 --><!--
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>-->
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace AcStoreWCF
{
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的类名“SMDBox”。
public class CWSMDBox : ICWSMDBox
{
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public string DoWork(int num)
{
return "这是第"+num+"次调用DoWork";
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace AcStoreWCF
{
// 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码和配置文件中的接口名“ISMDBox”。
[ServiceContract]
public interface ICWSMDBox
{
[OperationContract]
string DoWork(int num);
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("AcStoreWCF")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AcStoreWCF")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("bc133455-a1c9-4202-8489-16458c7fa5e5")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
...@@ -84,6 +85,7 @@ ...@@ -84,6 +85,7 @@
</Compile> </Compile>
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="WCFControl.cs" />
<EmbeddedResource Include="FrmAxisDebug.resx"> <EmbeddedResource Include="FrmAxisDebug.resx">
<DependentUpon>FrmAxisDebug.cs</DependentUpon> <DependentUpon>FrmAxisDebug.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
...@@ -198,6 +200,10 @@ ...@@ -198,6 +200,10 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\AcStoreWCF\AcStoreWCF.csproj">
<Project>{bc133455-a1c9-4202-8489-16458c7fa5e5}</Project>
<Name>AcStoreWCF</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj"> <ProjectReference Include="..\Common\Common.csproj">
<Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project> <Project>{43cdd09e-fcf3-4960-a01d-3bbfe9933122}</Project>
<Name>Common</Name> <Name>Common</Name>
...@@ -218,6 +224,9 @@ ...@@ -218,6 +224,9 @@
<ItemGroup> <ItemGroup>
<Content Include="box.ico" /> <Content Include="box.ico" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- 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. Other similar extension points exist, see Microsoft.Common.targets.
......
...@@ -52,4 +52,37 @@ ...@@ -52,4 +52,37 @@
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup> </startup>
<!-- 部署服务库项目时,必须将配置文件的内容添加到
主机的 app.config 文件中。System.Configuration 不支持库的配置文件。 -->
<system.serviceModel>
<services>
<service name="AcStoreWCF.CWSMDBox">
<endpoint address="" binding="basicHttpBinding" contract="AcStoreWCF.ICWSMDBox">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/AcStoreWCF/CWSMDBox/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,
请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- 要接收故障异常详细信息以进行调试,
请将以下值设置为 true。在部署前设置为 false
以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration> </configuration>
...@@ -158,12 +158,16 @@ ...@@ -158,12 +158,16 @@
this.txtPosition2 = new System.Windows.Forms.TextBox(); this.txtPosition2 = new System.Windows.Forms.TextBox();
this.txtPosition1 = new System.Windows.Forms.TextBox(); this.txtPosition1 = new System.Windows.Forms.TextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.btnCloseWCF = new System.Windows.Forms.Button();
this.btnOpenWCF = new System.Windows.Forms.Button();
this.groupBox5.SuspendLayout(); this.groupBox5.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout(); this.groupBox2.SuspendLayout();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
this.groupBox6.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// timer1 // timer1
...@@ -1580,28 +1584,28 @@ ...@@ -1580,28 +1584,28 @@
// 启动ToolStripMenuItem // 启动ToolStripMenuItem
// //
this.启动ToolStripMenuItem.Name = "启动ToolStripMenuItem"; this.启动ToolStripMenuItem.Name = "启动ToolStripMenuItem";
this.启动ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.启动ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.启动ToolStripMenuItem.Text = "启动"; this.启动ToolStripMenuItem.Text = "启动";
this.启动ToolStripMenuItem.Click += new System.EventHandler(this.启动ToolStripMenuItem_Click); this.启动ToolStripMenuItem.Click += new System.EventHandler(this.启动ToolStripMenuItem_Click);
// //
// 停止ToolStripMenuItem // 停止ToolStripMenuItem
// //
this.停止ToolStripMenuItem.Name = "停止ToolStripMenuItem"; this.停止ToolStripMenuItem.Name = "停止ToolStripMenuItem";
this.停止ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.停止ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.停止ToolStripMenuItem.Text = "停止"; this.停止ToolStripMenuItem.Text = "停止";
this.停止ToolStripMenuItem.Click += new System.EventHandler(this.停止ToolStripMenuItem_Click); this.停止ToolStripMenuItem.Click += new System.EventHandler(this.停止ToolStripMenuItem_Click);
// //
// 复位ToolStripMenuItem // 复位ToolStripMenuItem
// //
this.复位ToolStripMenuItem.Name = "复位ToolStripMenuItem"; this.复位ToolStripMenuItem.Name = "复位ToolStripMenuItem";
this.复位ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.复位ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.复位ToolStripMenuItem.Text = "复位"; this.复位ToolStripMenuItem.Text = "复位";
this.复位ToolStripMenuItem.Click += new System.EventHandler(this.复位ToolStripMenuItem_Click); this.复位ToolStripMenuItem.Click += new System.EventHandler(this.复位ToolStripMenuItem_Click);
// //
// 回待机点ToolStripMenuItem // 回待机点ToolStripMenuItem
// //
this.回待机点ToolStripMenuItem.Name = "回待机点ToolStripMenuItem"; this.回待机点ToolStripMenuItem.Name = "回待机点ToolStripMenuItem";
this.回待机点ToolStripMenuItem.Size = new System.Drawing.Size(124, 22); this.回待机点ToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.回待机点ToolStripMenuItem.Text = "回待机点"; this.回待机点ToolStripMenuItem.Text = "回待机点";
this.回待机点ToolStripMenuItem.Click += new System.EventHandler(this.回待机点ToolStripMenuItem_Click); this.回待机点ToolStripMenuItem.Click += new System.EventHandler(this.回待机点ToolStripMenuItem_Click);
// //
...@@ -1815,11 +1819,45 @@ ...@@ -1815,11 +1819,45 @@
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = "设备状态"; this.groupBox3.Text = "设备状态";
// //
// groupBox6
//
this.groupBox6.Controls.Add(this.btnOpenWCF);
this.groupBox6.Controls.Add(this.btnCloseWCF);
this.groupBox6.Location = new System.Drawing.Point(603, 645);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(642, 66);
this.groupBox6.TabIndex = 269;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "WCF测试";
//
// btnCloseWCF
//
this.btnCloseWCF.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCloseWCF.Location = new System.Drawing.Point(162, 22);
this.btnCloseWCF.Name = "btnCloseWCF";
this.btnCloseWCF.Size = new System.Drawing.Size(105, 28);
this.btnCloseWCF.TabIndex = 225;
this.btnCloseWCF.Text = "关闭服务";
this.btnCloseWCF.UseVisualStyleBackColor = true;
this.btnCloseWCF.Click += new System.EventHandler(this.btnCloseWCF_Click);
//
// btnOpenWCF
//
this.btnOpenWCF.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOpenWCF.Location = new System.Drawing.Point(34, 22);
this.btnOpenWCF.Name = "btnOpenWCF";
this.btnOpenWCF.Size = new System.Drawing.Size(105, 28);
this.btnOpenWCF.TabIndex = 226;
this.btnOpenWCF.Text = "打开服务";
this.btnOpenWCF.UseVisualStyleBackColor = true;
this.btnOpenWCF.Click += new System.EventHandler(this.btnOpenWCF_Click);
//
// FrmStoreBox // FrmStoreBox
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1268, 730); this.ClientSize = new System.Drawing.Size(1268, 730);
this.Controls.Add(this.groupBox6);
this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox5);
...@@ -1847,6 +1885,7 @@ ...@@ -1847,6 +1885,7 @@
this.groupBox4.PerformLayout(); this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout(); this.groupBox3.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
...@@ -1988,6 +2027,9 @@ ...@@ -1988,6 +2027,9 @@
private System.Windows.Forms.TextBox txtAlarmStatus; private System.Windows.Forms.TextBox txtAlarmStatus;
private System.Windows.Forms.Button btnGetAlarm; private System.Windows.Forms.Button btnGetAlarm;
private System.Windows.Forms.GroupBox groupBox3; private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Button btnOpenWCF;
private System.Windows.Forms.Button btnCloseWCF;
} }
} }
...@@ -16,6 +16,7 @@ using log4net; ...@@ -16,6 +16,7 @@ using log4net;
using OnlineStore.DeviceLibrary; using OnlineStore.DeviceLibrary;
using System.IO.Ports; using System.IO.Ports;
using OnlineStore.LoadCSVLibrary; using OnlineStore.LoadCSVLibrary;
using AcStoreWCF;
namespace OnlineStore.ACSingleStore namespace OnlineStore.ACSingleStore
{ {
...@@ -237,6 +238,17 @@ namespace OnlineStore.ACSingleStore ...@@ -237,6 +238,17 @@ namespace OnlineStore.ACSingleStore
lblWarnMsg.Text = ""; lblWarnMsg.Text = "";
btnStartAuTo.Text = "开始自动出入库"; btnStartAuTo.Text = "开始自动出入库";
} }
if (WCFControl.isRun)
{
btnOpenWCF.Enabled = false;
btnCloseWCF.Enabled = true;
}
else
{
btnOpenWCF.Enabled = true ;
btnCloseWCF.Enabled = false ;
}
} }
private void ReadPosistion() private void ReadPosistion()
...@@ -341,6 +353,7 @@ namespace OnlineStore.ACSingleStore ...@@ -341,6 +353,7 @@ namespace OnlineStore.ACSingleStore
KNDManager.CloseAllDO(); KNDManager.CloseAllDO();
StoreOpenStatus(false); StoreOpenStatus(false);
KNDManager.CloseAllConnection(); KNDManager.CloseAllConnection();
WCFControl.CloseWCF();
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -1006,6 +1019,8 @@ namespace OnlineStore.ACSingleStore ...@@ -1006,6 +1019,8 @@ namespace OnlineStore.ACSingleStore
IsInProcess = false; IsInProcess = false;
} }
public List<WaitResultInfo> waitResultList = new List<WaitResultInfo>(); public List<WaitResultInfo> waitResultList = new List<WaitResultInfo>();
private void btnStart_Click(object sender, EventArgs e) private void btnStart_Click(object sender, EventArgs e)
{ {
waitResultList = new List<WaitResultInfo>(); waitResultList = new List<WaitResultInfo>();
...@@ -1097,5 +1112,15 @@ namespace OnlineStore.ACSingleStore ...@@ -1097,5 +1112,15 @@ namespace OnlineStore.ACSingleStore
int value = ACServerManager.GetHomeEndStatus(GetPortName(), GetSlaveAddr()); int value = ACServerManager.GetHomeEndStatus(GetPortName(), GetSlaveAddr());
this.txtHomeStatus.Text = value.ToString(); this.txtHomeStatus.Text = value.ToString();
} }
private void btnOpenWCF_Click(object sender, EventArgs e)
{
WCFControl.OpenWCF();
}
private void btnCloseWCF_Click(object sender, EventArgs e)
{
WCFControl.CloseWCF();
}
} }
} }
using log4net;
using OnlineStore.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.ServiceModel;
using System.Text;
namespace OnlineStore.ACSingleStore
{
public class WCFControl
{
public static bool isRun=false;
public static readonly ILog LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private static ServiceHost host = null;
public static void OpenWCF()
{
if (isRun)
{
return;
}
try
{
if (host == null)
{
host = new ServiceHost(typeof(AcStoreWCF.CWSMDBox));
}
if (host.State != CommunicationState.Opening)
{
host.Open();
}
isRun = true;
LogUtil.info("打开WCF服务成功");
}
catch (Exception ex)
{
LogUtil.error("打开WCF服务出错:" + ex.ToString());
}
}
public static void CloseWCF()
{
try
{
isRun = false;
if (host != null)
{
host.Close();
}
LogUtil.info("关闭WCF服务成功");
}
catch (Exception ex)
{
LogUtil.error("关闭WCF服务出错:" + ex.ToString());
}
}
}
}
...@@ -203,7 +203,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -203,7 +203,7 @@ namespace OnlineStore.DeviceLibrary
LogUtil.info( "串口" + portName + " 收到数据:" + strSend + ""); LogUtil.info( "串口" + portName + " 收到数据:" + strSend + "");
} }
} }
public static void aSendData(string portName, byte[] data) public static void SendData(string portName, byte[] data)
{ {
if (data == null) if (data == null)
{ {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!