Commit 22f07d8c authored by 潘栩锋's avatar 潘栩锋 🚴

添加检测 FObjSys 添加检测 OBJ ID 是否唯一功能

parent d2745d61
...@@ -66,6 +66,26 @@ namespace FObjBase ...@@ -66,6 +66,26 @@ namespace FObjBase
Objs.Add(obj, new List<Sense>()); Objs.Add(obj, new List<Sense>());
} }
/// <summary> /// <summary>
/// 检测 全部Obj 的ID 是否都唯一
/// </summary>
/// <returns></returns>
public bool CheckObjIDUnique()
{
for (int i = 0; i < Objs.Count(); i++)
{
var kv1 = Objs.ElementAt(i);
for (int j = i + 1; j < Objs.Count(); j++)
{
var kv2 = Objs.ElementAt(j);
if (kv1.Key.ID == kv2.Key.ID)
{
return false;
}
}
}
return true;
}
/// <summary>
/// 对外发送消息 /// 对外发送消息
/// </summary> /// </summary>
/// <param name="s1">远端对应的连接代理 </param> /// <param name="s1">远端对应的连接代理 </param>
...@@ -620,6 +640,7 @@ namespace FObjBase ...@@ -620,6 +640,7 @@ namespace FObjBase
{ {
try try
{ {
KeyValuePair<IFObj, List<Sense>> obj_kv = Objs.First(obj => obj.Key.ID == objid); KeyValuePair<IFObj, List<Sense>> obj_kv = Objs.First(obj => obj.Key.ID == objid);
return obj_kv.Key; return obj_kv.Key;
} }
......
...@@ -105,6 +105,7 @@ namespace FObjBase ...@@ -105,6 +105,7 @@ namespace FObjBase
/// </summary> /// </summary>
public class FObj : IFObj public class FObj : IFObj
{ {
public FObj() public FObj()
{ {
ID = 0; ID = 0;
...@@ -116,6 +117,10 @@ namespace FObjBase ...@@ -116,6 +117,10 @@ namespace FObjBase
this.objsys_idx = objsys_idx; this.objsys_idx = objsys_idx;
CurrObjSys.ObjAdd(this); CurrObjSys.ObjAdd(this);
} }
public override string ToString()
{
return $@"[{ID}] {GetType().Name}";
}
#region IFObj 成员 #region IFObj 成员
private int objsys_idx=0; private int objsys_idx=0;
......
...@@ -307,7 +307,7 @@ ...@@ -307,7 +307,7 @@
<sys:String x:Key="strCSCorr">机架修正</sys:String> <sys:String x:Key="strCSCorr">机架修正</sys:String>
<sys:String x:Key="strCSGetSample">获取样品</sys:String> <sys:String x:Key="strCSGetSample">获取样品</sys:String>
<sys:String x:Key="strCSRunning">运行至..</sys:String> <sys:String x:Key="strCSRunning">运行至..</sys:String>
<sys:String x:Key="strCSDisconnetced">连接断开</sys:String> <sys:String x:Key="strCSDisconnected">连接断开</sys:String>
<sys:String x:Key="strCSGageInfo">机架信息</sys:String> <sys:String x:Key="strCSGageInfo">机架信息</sys:String>
<sys:String x:Key="strCSPause">暂停</sys:String> <sys:String x:Key="strCSPause">暂停</sys:String>
<sys:String x:Key="strCSAutoScan">自动扫描</sys:String> <sys:String x:Key="strCSAutoScan">自动扫描</sys:String>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props')" /> <Import Project="..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
</ApplicationIcon> </ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PropertyChanged2, Version=2.5.13.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL"> <Reference Include="PropertyChanged2, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.5.13\lib\net40\PropertyChanged2.dll</HintPath> <HintPath>..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\lib\net40\PropertyChanged2.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
...@@ -203,13 +203,13 @@ ...@@ -203,13 +203,13 @@
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.2.13\build\Fody.targets" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.2.13\build\Fody.targets')" /> <Import Project="..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.5\build\Fody.targets" Condition="Exists('..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.5\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup> <PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText> <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup> </PropertyGroup>
<Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.2.13\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.2.13\build\Fody.targets'))" /> <Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\Fody.3.3.5\build\Fody.targets'))" />
<Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.5.13\build\PropertyChanged2.Fody.props'))" /> <Error Condition="!Exists('..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\Project.FLY.Thick.Normal\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props'))" />
</Target> </Target>
<!-- 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.
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<Weavers> <Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged2 /> <PropertyChanged2 />
</Weavers> </Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Fody" version="3.2.13" targetFramework="net40" developmentDependency="true" /> <package id="Fody" version="3.3.5" targetFramework="net40" developmentDependency="true" />
<package id="PropertyChanged2.Fody" version="2.5.13" targetFramework="net40" /> <package id="PropertyChanged2.Fody" version="2.6.0" targetFramework="net40" />
</packages> </packages>
\ No newline at end of file
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