Commit 12787164 authored by 潘栩锋's avatar 潘栩锋 🚴
parents 3b0ebc03 6176c8fa
......@@ -333,27 +333,25 @@ namespace FObjBase.Reflect
foreach (var methodInfo in methodInfos)
{
var parameterInfos = methodInfo.GetParameters();
var names = parameterInfos.Select(pi => pi.Name);
//全部参数名称
var names = parameterInfos.Select(pi => pi.Name).ToList();
//删除掉 asyncDelegate,asyncContext
names.Remove("asyncDelegate");
names.Remove("asyncContext");
var names_req = parameterNames;
//比较 names 与 names_data
var exps_req = names_req.Except(names);
if (exps_req.Count() != 0)
{
//请求的参数,这个method 不是全部都有
continue;
}
var exps = names.Except(names_req);
if (exps.Count() == 2 && exps.Contains("asyncDelegate") && exps.Contains("asyncContext"))
{
//请求的参数 就只有 "asyncDelegate" 与 "asyncContext" 没有而已
//这个就是需要调用的 method
return methodInfo;
}
else
{
continue;
}
if (names.Count() != names_req.Count())
continue;//数量不一致,肯定不同
var sames = names_req.Intersect(names);
if (sames.Count() != names_req.Count())
continue;// names 与 names_req 的交集数量与names_req不一样,肯定不同
//就是它
return methodInfo;
}
return null;
}
......
......@@ -330,6 +330,10 @@ namespace FObjBase.Reflect
//触发事件!!!
var methodInfo = GetType().GetMethod(anyEvent.triggerName);
if (methodInfo == null)
{
throw new Exception($"客户端 {GetType()} 忘记写 {anyEvent.triggerName}");
}
var obj = rData.data.ToObject(anyEvent.retType);
//出错,就提示,肯定是客户端忘记写 "Trigger_XXXX"
methodInfo.Invoke(this, new object[] { obj });
......
......@@ -69,7 +69,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>2.6.1</Version>
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -59,6 +59,11 @@
<Name>FLY.Simulation</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
......
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
......@@ -21,74 +21,23 @@ namespace FLY.Simulation.Casting
/// <summary>
/// 1脉冲 = ? mm
/// </summary>
double mmpp = 0.1133;
public double Mmpp {
get { return mmpp; }
set {
mmpp = value;
}
}
public double Mmpp { get; set; } = 0.0945;
double filmvelocity = 23;
/// <summary>
/// 膜速度 m/min
/// </summary>
public double FilmVelocity
{
get
{
return filmvelocity;
}
set
{
if (filmvelocity != value)
{
filmvelocity = value;
NotifyPropertyChanged("FilmVelocity");
}
}
}
public double FilmVelocity { get; set; } = 23;
double filmlength = 0;
/// <summary>
/// 膜长 m
/// </summary>
public double FilmLength
{
get
{
return filmlength;
}
set
{
if (filmlength != value)
{
filmlength = value;
NotifyPropertyChanged("FilmLength");
}
}
}
public double FilmLength { get; set; }
bool isRunning = true;
/// <summary>
/// 运转中
/// </summary>
public bool IsRunning
{
get
{
return isRunning;
}
set
{
if (isRunning != value)
{
isRunning = value;
NotifyPropertyChanged("IsRunning");
}
}
}
public bool IsRunning { get; set; } = true;
public GageAD()
{
curve = new CurveCollection("curve.xml");
......@@ -185,13 +134,6 @@ namespace FLY.Simulation.Casting
return 0;
}
protected void NotifyPropertyChanged(string propertyname)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyname));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
......@@ -68,7 +68,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>2.6.1</Version>
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -92,8 +92,11 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper">
<Version>10.1.1</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>2.6.1</Version>
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -8,10 +8,13 @@ using System.IO;
using System.ComponentModel;
using System.Xml.Serialization;
using FlyADBase;
using static FLY.Simulation.Flyad7.FLYAD7;
using AutoMapper;
using Newtonsoft.Json;
namespace FLY.Simulation.Flyad7
{
public class FLYAD7 : IFlyAD, INotifyPropertyChanged, Misc.ISaveToXml
public class FLYAD7 : IFlyAD, INotifyPropertyChanged
{
private IPEndPoint localep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 20008);
......@@ -77,23 +80,11 @@ namespace FLY.Simulation.Flyad7
/// </summary>
Casting
}
private SIM_MODE simmode = SIM_MODE.Coating;
/// <summary>
/// 系统重启时,mSimModeCurr = SimMode ,之后怎么变化都不会影响 mSimModeCurr
/// </summary>
public SIM_MODE SimMode
{
get {
return simmode;
}
set {
if (simmode != value)
{
simmode = value;
NotifyPropertyChanged("SimMode");
}
}
}
public SIM_MODE SimMode { get; set; } = SIM_MODE.Coating;
/// <summary>
/// 当前模拟类型
......@@ -104,16 +95,9 @@ namespace FLY.Simulation.Flyad7
//public SimDrive_Servo mSimDriveServo = new SimDrive_Servo();
#endregion
private string param_path;
public FLYAD7():this("simulation_flyad7.xml")
{
}
public FLYAD7(string param_path)
public FLYAD7()
{
this.param_path = param_path;
PosOfGrid = 10;
Load();
mSimMode = SimMode;
......@@ -230,14 +214,38 @@ namespace FLY.Simulation.Flyad7
}
string file_path = "simulation_flyad7.json";
public void Save()
{
Misc.SaveToXmlHepler.Save(param_path, this);
var p = FlyAd7JsonDb.Mapper.Map<FlyAd7JsonDb>(this);
try
{
File.WriteAllText(file_path, JsonConvert.SerializeObject(p, Formatting.Indented));
}
catch
{
//异常,没有json 编码失败
}
}
public void Load()
void Load()
{
Misc.SaveToXmlHepler.Load(param_path, this);
try
{
if (File.Exists(file_path))
{
string json = File.ReadAllText(file_path);
var p = JsonConvert.DeserializeObject<FlyAd7JsonDb>(json);
FlyAd7JsonDb.Mapper.Map(p, this);
}
}
catch
{
//异常,没有json 解码失败
}
}
......@@ -604,26 +612,16 @@ namespace FLY.Simulation.Flyad7
}
private MOTORTYPE motorType = MOTORTYPE.VF0;
public MOTORTYPE MotorType
public MOTORTYPE MotorType { get; set; } = MOTORTYPE.VF0;
void OnMotorTypeChanged()
{
get
{
return motorType;
}
set
{
if (motorType != value)
{
motorType = value;
//TODO
mSimDrive.MotorType = value;
}
}
//TODO
mSimDrive.MotorType = MotorType;
}
//1个Grid=?脉冲数(2B)
public UInt16 PosOfGrid { get; set; }
public UInt16 PosOfGrid { get; set; } = 10;
......@@ -644,24 +642,12 @@ namespace FLY.Simulation.Flyad7
public Int16 PosOffset { get; set; }
UInt32 jogVelocity=500;
public UInt32 JogVelocity
{
get
{
return jogVelocity;
}
set
{
if (jogVelocity != value)
{
jogVelocity = value;
mOrderMan.order_forw.Velocity = (int)JogVelocity;
mOrderMan.order_backw.Velocity = (int)JogVelocity;
}
}
public UInt32 JogVelocity { get; set; } = 500;
void OnJogVelocityChanged() {
//TODO
mOrderMan.order_forw.Velocity = (int)JogVelocity;
mOrderMan.order_backw.Velocity = (int)JogVelocity;
}
#region 速度
UInt32 velocity;
public UInt32 Velocity
......@@ -1101,19 +1087,43 @@ namespace FLY.Simulation.Flyad7
#endregion
#endregion
public string[] GetSavePropertyNames()
{
return new string[] {
"LocalEP",
"SimMode",
"MotorType"
};
}
public void SetVelocity(uint velocity)
{
Velocity = velocity;
}
}
public class FlyAd7JsonDb
{
public static Mapper Mapper { get; } = new AutoMapper.Mapper(new MapperConfiguration(c =>
{
c.CreateMap<FLYAD7, FlyAd7JsonDb>().ForMember(d => d.Addr, opt =>
{
opt.MapFrom(s=>s.LocalEP.ToString());
}).ReverseMap().ForMember(d => d.LocalEP, opt =>
{
opt.MapFrom(s => Misc.StringConverter.ToIPEndPoint(s.Addr));
});
}));
public string Addr;
public SIM_MODE SimMode;
public MOTORTYPE MotorType;
public UInt16 PosOfGrid;
/// <summary>
/// //电机比例(2B)
/// </summary>
public UInt16 Ratio01;
/// <summary>
/// 脉冲比例(2B)
/// </summary>
public UInt16 Ratio02;
public UInt32 JogVelocity;
public Int16 PosOffset;
}
public static class FLYAD7_IODefinition
{
......
......@@ -101,6 +101,7 @@ namespace FLY.Simulation.Flyad7.OBJProxy
Data.MotorType = motortype;
Data.Ratio01 = pack.ratio01;
Data.Ratio02 = pack.ratio02;
Data.Save();
} break;
case FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.SET_ZERO_POS:
{
......@@ -109,6 +110,7 @@ namespace FLY.Simulation.Flyad7.OBJProxy
break;
Data.PosOffset = pack.zero_pos;
Data.JogVelocity = pack.jog_velocity;
Data.Save();
} break;
}
}
......
......@@ -59,6 +59,11 @@
<Name>FLY.Simulation</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
......
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
......@@ -55,6 +55,11 @@
<Name>Misc</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody">
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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.
......
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
</Weavers>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="EventInvokerNames" type="xs:string">
<xs:annotation>
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEquality" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
<xs:annotation>
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>
\ No newline at end of file
......@@ -186,18 +186,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody">
<Version>3.3.3</Version>
</PackageReference>
<PackageReference Include="Fody">
<Version>4.2.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>2.6.1</Version>
<Version>3.2.5</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -201,12 +201,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Costura.Fody">
<Version>3.3.3</Version>
</PackageReference>
<PackageReference Include="Fody">
<Version>4.2.1</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="MathNet.Numerics">
<Version>4.9.0</Version>
......@@ -218,10 +213,10 @@
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="PropertyChanged.Fody">
<Version>2.6.1</Version>
<Version>3.2.5</Version>
</PackageReference>
<PackageReference Include="Unity">
<Version>5.11.1</Version>
<Version>5.11.7</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
......
......@@ -82,7 +82,7 @@ namespace FLY.Thick.Base.UI.OnInit
DynArea dynarea = s as DynArea;
var t = tags.Find(_t => _t.dynArea == dynarea);
if (e.PropertyName == "ControllerState")
if (e.PropertyName == nameof(DynArea.ControllerState))
{
UpdateControllerState(t);
}
......@@ -104,6 +104,8 @@ namespace FLY.Thick.Base.UI.OnInit
return;
//找出设备页面
if (manager.layout.GageTabItems == null)
return;
var gageTabItems = from _gageTabItem in manager.layout.GageTabItems where _gageTabItem.ServiceContainerName == rontainerName select _gageTabItem;
if (gageTabItems.Count() == 0)
return;
......
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