Commit 7e62d955 authored by 潘栩锋's avatar 潘栩锋 🚴

添加 WSCF 服务

parent 2f450226
......@@ -75,6 +75,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiveCharts.Feng.Wpf", "thic
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Thick.FilmCasting.WebAPI", "Project.FLY.Thick.FilmCasting\FLY.Thick.FilmCasting.WebAPI\FLY.Thick.FilmCasting.WebAPI.csproj", "{3BFDB604-CA63-4034-B967-25DECA190C21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WSCF", "Project.FLY.Thick.FilmCasting\WSCF\WSCF.csproj", "{712D814B-00B7-4DEC-8105-FE06F25D36A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -323,6 +325,14 @@ Global
{3BFDB604-CA63-4034-B967-25DECA190C21}.Release|Any CPU.Build.0 = Release|Any CPU
{3BFDB604-CA63-4034-B967-25DECA190C21}.Release|x86.ActiveCfg = Release|Any CPU
{3BFDB604-CA63-4034-B967-25DECA190C21}.Release|x86.Build.0 = Release|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Debug|x86.Build.0 = Debug|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Release|Any CPU.Build.0 = Release|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Release|x86.ActiveCfg = Release|Any CPU
{712D814B-00B7-4DEC-8105-FE06F25D36A1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -358,6 +368,7 @@ Global
{349CDC12-8CA8-4606-957E-F378E118B93D} = {9069666C-D456-4983-8AA5-AEE36F7177FF}
{A7ACD496-9D04-4F8E-B97E-C6C29CE2DE06} = {9069666C-D456-4983-8AA5-AEE36F7177FF}
{3BFDB604-CA63-4034-B967-25DECA190C21} = {084448C0-49B0-44CE-850E-24E6DBE224D1}
{712D814B-00B7-4DEC-8105-FE06F25D36A1} = {084448C0-49B0-44CE-850E-24E6DBE224D1}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2E6E5899-CCF7-4DE1-BE64-7EB93DC24D73}
......
using FLY.Thick.FilmCasting.Server;
using FLY.Thick.FilmCasting.Server.OBJProxy;
using FLY.Thick.FilmCasting.Server.WsProxy;
using FLY.Thick.FilmCasting.WebAPI;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Navigation;
using WebSocketSharp.Server;
namespace FLY.Thick.FilmCasting.UI.Server
{
......@@ -14,9 +16,15 @@ namespace FLY.Thick.FilmCasting.UI.Server
{
FLY.AppHelper.WindowNotifyIconHelper notifyiconhelper;
TDGage mGage;
OBJProxy mOBJProxy;
OBJProxys mOBJProxy;
PicHistory picHistory;
ThkWebApiServer thkWebApiServer;
/// <summary>
/// WebSocket 服务
/// </summary>
WebSocketServer wss;
WsProxys thkWsProxys;
public MainWindow()
{
InitializeComponent();
......@@ -30,10 +38,21 @@ namespace FLY.Thick.FilmCasting.UI.Server
private async void NavigationWindow_Loaded(object sender, RoutedEventArgs e)
{
mGage = new TDGage("Gage1");
string mParamDirectory = "Gage1";
if (!System.IO.Directory.Exists(mParamDirectory))
{
System.IO.Directory.CreateDirectory(mParamDirectory);
}
System.Environment.CurrentDirectory = mParamDirectory;
mGage = new TDGage();
await mGage.Init();
mOBJProxy = new OBJProxy(0, mGage);
mOBJProxy = new OBJProxys(0, mGage);
FObjBase.FObjSys.Currents[0].Start_Conn_Server(
Misc.StringConverter.ToIPEndPoint(mGage.sysParam.Addr));
FObjBase.PollModule.Current.Start();
......@@ -49,6 +68,10 @@ namespace FLY.Thick.FilmCasting.UI.Server
thkWebApiServer.Init(mGage);
thkWebApiServer.Start();
wss = new WebSocketServer($"ws://localhost:5540/");
thkWsProxys = new WsProxys(wss, mGage);
wss.Start();
this.Hide();
PgMain p = new PgMain();
p.Init(mGage,picHistory,thkWebApiServer);
......
......@@ -63,7 +63,8 @@
<Compile Include="IService\IShareDbService.cs" />
<Compile Include="OBJ_INTERFACE\OBJ_INTERFACE_ID.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Server.OBJProxy\OBJProxy.cs" />
<Compile Include="Server.OBJProxy\OBJProxys.cs" />
<Compile Include="Server.WsProxy\WsProxys.cs" />
<Compile Include="Server\BoltMapFilmCasting.cs" />
<Compile Include="Server\FilmCastingProfile.cs" />
<Compile Include="Server\FilmPositionDetect2.cs" />
......@@ -109,6 +110,10 @@
<Project>{4cbabfaa-1c62-4510-ac63-a51ee5fd50ff}</Project>
<Name>SQLiteHelper</Name>
</ProjectReference>
<ProjectReference Include="..\WSCF\WSCF.csproj">
<Project>{712d814b-00b7-4dec-8105-fe06f25d36a1}</Project>
<Name>WSCF</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper">
......@@ -123,6 +128,9 @@
<PackageReference Include="PropertyChanged.Fody">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="WebSocketSharp-netstandard">
<Version>1.0.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
using FLY.Thick.Base.IService;
using FLY.Thick.Base.Server;
using FLY.Thick.FilmCasting.Common;
using FLY.Thick.FilmCasting.IService;
using FLY.Thick.FilmCasting.OBJ_INTERFACE;
using IInitParamService = FLY.Thick.FilmCasting.IService.IInitParamService;
namespace FLY.Thick.FilmCasting.Server.OBJProxy
{
public class OBJProxy
{
FlyAdService flyAdService;
public OBJProxy(int objsys_idx, TDGage gage)
{
var jsonDistOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.JSONDIST_ID,
typeof(OBJComponents.IService.IJsonDistService), new OBJComponents.Server.JsonDist());
var warnSystemOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.WARNING_OBJ_ID,
typeof(OBJComponents.IService.IWarningSystem2Service), gage.warning);
var ioDefineObjProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.IO_ID,
typeof(IFlyAdIoDefineService), FlyADIODefine.Instance);
var gageOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.TDGAGE_ID,
typeof(ITDGageService), gage);
var borderSearchOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.BORDERSEARCH_ID,
typeof(IBorderSearchService), gage.borderSearch);
var curveOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.CURVE_ID,
typeof(ICurveService), gage.curve);
var getSampleOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.GET_SAMPLE_ID,
typeof(IGetSampleService), gage.getSample);
var initParamOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.INITPARAM_ID,
typeof(IInitParamService),gage.initParam);
var scanCorrOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.SCANCORR_ID,
typeof(IScanCorrService),gage.gmScanCorr);
var flyAdOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.FLYAD_ID,
typeof(IFlyADService), gage.flyAdService);
var gageInfoOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.GAGEINFO_ID,
typeof(IGageInfoService), gage.gmGageInfo);
var fixOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.FIX_ID,
typeof(IFixService), gage.gmFix);
var profileOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.PROFILE_ID,
typeof(IFilmCastingProfileService), gage.profile);
var scanWarningOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.SCANWARNING_ID,
typeof(IScanWarningService), gage.scanWarning);
var boltMapOBJProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.BOLTMAP_ID,
typeof(IBoltMapFilmCastingService), gage.boltmap);
var bulkDbObjProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.BULKDB_ID,
typeof(IBulkDbService), gage.bulkDb);
var rejectObjProxy = new FObjBase.Reflect.Reflect_Proxy(objsys_idx, OBJ_INTERFACE_ID.REJECT_ID,
typeof(IRejectService), gage.reject);
FObjBase.FObjSys.Currents[objsys_idx].Start_Conn_Server(
Misc.StringConverter.ToIPEndPoint(gage.sysParam.Addr));
}
}
}
......@@ -192,15 +192,9 @@ namespace FLY.Thick.FilmCasting.Server
#endregion
public TDGage(string nam)
public TDGage()
{
mParamDirectory = nam;// @"D:\" + m_name;
if (!System.IO.Directory.Exists(mParamDirectory))
{
System.IO.Directory.CreateDirectory(mParamDirectory);
}
System.Environment.CurrentDirectory = mParamDirectory;
#region create
sysParam = new SysParam(null);//系统参数
......
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