Commit d666008f authored by 潘栩锋's avatar 潘栩锋 🚴

可以读取同步指令列表数量

parent 02ab8eb9
......@@ -1322,6 +1322,17 @@ namespace FLY.Simulation.Flyad7
{
mSyncPos2List.Clear();
}
public UInt16 GetSyncOrderCnt()
{
return (UInt16)mSyncOrderList.Count();
}
public SYNC_STATUS GetSyncStatus()
{
if (DriveOrder == DRIVE_MAN_ORDER.SYNC)
return SYNC_STATUS.SYNCST_YES;
else
return SYNC_STATUS.SYNCST_NO;
}
#endregion
#region 同步扫描 脚本指令
......
......@@ -38,6 +38,21 @@ namespace FLY.Simulation.Flyad7.OBJProxy
pack.mode = 1;
infodata = pack.ToBytes();
}break;
case FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_SYNC_STATUS:
{
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncStatus pack = new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncStatus();
pack.status = Data.GetSyncStatus();
infodata = pack.ToBytes();
}
break;
case FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_SYNC_ORDER_CNT:
{
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncOrderCnt pack = new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncOrderCnt();
pack.cnt = Data.GetSyncOrderCnt();
infodata = pack.ToBytes();
}
break;
}
}
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" />
<Import Project="..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props" Condition="Exists('..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
......@@ -10,12 +12,14 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FLYAD7_Simulation_Wpf</RootNamespace>
<AssemblyName>FLYAD7_Simulation_Wpf</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -26,6 +30,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -35,6 +40,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
......@@ -43,6 +49,15 @@
<ApplicationIcon>games_control.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=3.3.3.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.3.3.3\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PropertyChanged, Version=2.6.1.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\packages\PropertyChanged.Fody.2.6.1\lib\net452\PropertyChanged.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
......@@ -129,6 +144,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......@@ -177,6 +193,15 @@
<Resource Include="games_control.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props'))" />
</Target>
<!-- 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">
......
......@@ -11,128 +11,32 @@ namespace FLYAD7_Simulation_Wpf
{
public class FlyADClientUI : INotifyPropertyChanged
{
private int position;
public int Position
{
get { return position; }
set
{
if (position != value)
{
position = value;
PropertyChanged.Notify(this, "Position");
}
}
}
private int speed;
public int Speed
{
get { return speed; }
set
{
if (speed != value)
{
speed = value;
PropertyChanged.Notify(this, "Speed");
}
}
}
private int position2;
public int Position2
{
get { return position2; }
set
{
if (position2 != value)
{
position = value;
PropertyChanged.Notify(this, "Position2");
}
}
}
private int speed2;
public int Speed2
{
get { return speed2; }
set
{
if (speed2 != value)
{
speed = value;
PropertyChanged.Notify(this, "Speed2");
}
}
}
public int Position { get; set; }
private int ad;
public int AD
{
get { return ad; }
set
{
if (ad != value)
{
ad = value;
PropertyChanged.Notify(this, "AD");
}
}
}
private UInt16 istatus;
public UInt16 IStatus
{
get { return istatus; }
set
{
if (istatus != value)
{
istatus = value;
PropertyChanged.Notify(this, "IStatus");
}
}
}
public int Speed { get; set; }
private UInt16 ostatus = 0xf;
public UInt16 OStatus
{
get { return ostatus; }
set
{
if (ostatus != value)
{
ostatus = value;
PropertyChanged.Notify(this, "OStatus");
}
}
}
private double timespan1ms;
public double TimeSpan1ms
{
get { return timespan1ms; }
set
{
if (timespan1ms != value)
{
timespan1ms = value;
PropertyChanged.Notify(this, "TimeSpan1ms");
}
}
}
int surplus = 8000;
public int Surplus
{
get { return surplus; }
set
{
if (surplus != value)
{
surplus = value;
PropertyChanged.Notify(this, "Surplus");
}
}
}
public int Position2 { get; set; }
public int Speed2 { get; set; }
public int AD { get; set; }
public UInt16 IStatus { get; set; }
public UInt16 OStatus { get; set; } = 0xf;
public double TimeSpan1ms { get; set; }
public int Surplus { get; set; } = 8000;
private DispatcherTimer timer = new DispatcherTimer();
private FLYAD7 flyad;
public FlyADClientUI(FLYAD7 flyad)
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
<Costura />
</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="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<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
......@@ -19,7 +19,7 @@ namespace FLYAD7_Simulation_Wpf.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,7 +47,7 @@ namespace FLYAD7_Simulation_Wpf.Properties {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
......
......@@ -12,7 +12,7 @@ namespace FLYAD7_Simulation_Wpf.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="3.3.3" targetFramework="net462" />
<package id="Fody" version="4.2.1" targetFramework="net462" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net462" />
<package id="PropertyChanged.Fody" version="2.6.1" targetFramework="net462" />
</packages>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.572
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Flyad7_WPF", "Flyad7_WPF\Flyad7_WPF.csproj", "{FC6014B3-1105-4F08-B1D1-1F1398C999AF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLYAD7_Simulation_Wpf", "FLYAD7_Simulation_Wpf\FLYAD7_Simulation_Wpf.csproj", "{8B4BD389-49FB-48DC-8F40-4C1BA668BDAB}"
......@@ -13,7 +15,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation", "FLY.Simul
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.Simulation.Flyad7", "FLY.Simulation.Flyad7\FLY.Simulation.Flyad7.csproj", "{AE180A75-FAFA-4C5E-8767-0A26447936B6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.ModbusModule", "..\Project.FLY.ModbusModule\FLY.ModbusModule\FLY.ModbusModule.csproj", "{6D4B9BDA-2A66-4583-B244-758BC4213D9F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FLY.ModbusModule", "..\Project.FLY.ModbusModule\FLY.ModbusModule\FLY.ModbusModule.csproj", "{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Misc", "..\Project.FLY.Misc\MISC\Misc.csproj", "{5EE61AC6-5269-4F0F-B8FA-4334FE4A678F}"
EndProject
......@@ -102,16 +104,16 @@ Global
{AE180A75-FAFA-4C5E-8767-0A26447936B6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{AE180A75-FAFA-4C5E-8767-0A26447936B6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{AE180A75-FAFA-4C5E-8767-0A26447936B6}.Release|x86.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Debug|x86.ActiveCfg = Debug|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Any CPU.Build.0 = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{6D4B9BDA-2A66-4583-B244-758BC4213D9F}.Release|x86.ActiveCfg = Release|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Debug|x86.ActiveCfg = Debug|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Release|Any CPU.Build.0 = Release|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8E19C40F-CE7F-4982-BD90-4EB4E9E04E34}.Release|x86.ActiveCfg = Release|Any CPU
{5EE61AC6-5269-4F0F-B8FA-4334FE4A678F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EE61AC6-5269-4F0F-B8FA-4334FE4A678F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EE61AC6-5269-4F0F-B8FA-4334FE4A678F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
......@@ -176,4 +178,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3F98BF9E-BBA4-4827-8F9E-8C048F1A21FE}
EndGlobalSection
EndGlobal
......@@ -200,6 +200,59 @@ namespace FLYAD7_OBJ_INTERFACE
#endregion
}
public class Pack_SyncStatus : IPack
{
public SYNC_STATUS status;
#region IPack 成员
public byte[] ToBytes()
{
List<byte> buf = new List<byte>();
buf.Add((byte)status);
return buf.ToArray();
}
public bool TryParse(byte[] value)
{
if (value.Count() < (1))
return false;
int idx = 0;
status = (SYNC_STATUS)value[idx];
idx++;
return true;
}
#endregion
}
public class Pack_SyncOrderCnt : IPack
{
public UInt16 cnt;
#region IPack 成员
public byte[] ToBytes()
{
List<byte> buf = new List<byte>();
buf.AddRange(BitConverter.GetBytes(cnt));
return buf.ToArray();
}
public bool TryParse(byte[] value)
{
if (value.Count() < (2))
return false;
int idx = 0;
cnt = BitConverter.ToUInt16(value, idx);
idx += 2;
return true;
}
#endregion
}
public class Pack_MotorType : IPack
{
public MOTORTYPE motortype;
......@@ -927,6 +980,17 @@ namespace FLYAD7_OBJ_INTERFACE
/// Pack_DriveParam
/// </summary>
public const UInt16 GET_DRIVEPARAM = 0x102;
/// <summary>
/// 读同步状态 (1Byte)
/// </summary>
public const UInt16 GET_SYNC_STATUS = 0x103;
/// <summary>
/// 读同步指令数 (2Byte)
/// </summary>
public const UInt16 GET_SYNC_ORDER_CNT = 0x104;
#endregion
#region SetValue
......
......@@ -409,6 +409,18 @@ namespace FlyADBase
ID,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_STATE);
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_SYNC_ORDER_CNT);
CurrObjSys.GetValueEx(
conn,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID,
ID,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_SYNC_STATUS);
//FLYADC
CurrObjSys.GetValueEx(
conn,
......@@ -543,6 +555,23 @@ namespace FlyADBase
DriveStatus = p.status;
Marker = p.marker;
} break;
case FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_SYNC_STATUS:
{
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncStatus p = new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncStatus();
if (!p.TryParse(infodata))
break;
//TODO
}
break;
case FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.GET_SYNC_ORDER_CNT:
{
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncOrderCnt p = new FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.Pack_SyncOrderCnt();
if (!p.TryParse(infodata))
break;
//TODO
}
break;
}
} break;
case FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.ID:
......
......@@ -626,7 +626,21 @@ namespace FlyADBase
}
/// <summary>
/// 同步状态
/// </summary>
public enum SYNC_STATUS
{
SYNCST_NO = 0,
SYNCST_PENDING1 = 1,
SYNCST_PENDING2 = 2,
SYNCST_PENDING3 = 3,
SYNCST_TEMP_OUT = 4,
SYNCST_WAIT_TO_PENDING = 5,
SYNCST_RESUME = 6,
SYNCST_YES = 10,
}
......
......@@ -5,6 +5,7 @@ using System.Text;
using System.ComponentModel;
using FlyADBase;
using Misc;
using System.Windows.Threading;
namespace Flyad7_WPF
{
......@@ -14,48 +15,14 @@ namespace Flyad7_WPF
public class AutoForwBackw : INotifyPropertyChanged
{
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
DispatcherTimer timer;
FlyAD7 flyad;
private bool fbenable = false;
public bool FB_Enable
{
get { return fbenable; }
set
{
if (fbenable != value)
{
fbenable = value;
PropertyChanged.Notify(this, "FB_Enable");
}
}
}
private int fb_pos1 = 1000;
private int fb_pos2 = 3000;
public int FB_Pos1
{
get { return fb_pos1; }
set
{
if (fb_pos1 != value)
{
fb_pos1 = value;
PropertyChanged.Notify(this, "FB_Pos1");
}
}
}
public int FB_Pos2
{
get { return fb_pos2; }
set
{
if (fb_pos2 != value)
{
fb_pos2 = value;
PropertyChanged.Notify(this, "FB_Pos2");
}
}
}
public bool FB_Enable { get; set; }
public int FB_Pos1 { get; set; } = 1000;
public int FB_Pos2 { get; set; } = 3000;
public AutoForwBackw(FlyAD7 flyad)
{
......@@ -84,7 +51,8 @@ namespace Flyad7_WPF
}
void FB_init()
{
timer.Interval = 1000;
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += new EventHandler(timer_Tick);
FB_Enable = false;
this.PropertyChanged += new PropertyChangedEventHandler(MainWindow_PropertyChanged);
......
......@@ -4,110 +4,31 @@ using System.Linq;
using System.Text;
using System.ComponentModel;
using Misc;
using System.IO;
using Newtonsoft.Json;
namespace Flyad7_WPF
{
public class DebugAppParam : INotifyPropertyChanged
{
private string epstr = "192.168.251.10:20006";
public string EPStr
{
get
{
return epstr;
}
set
{
if (epstr != value)
{
epstr = value;
PropertyChanged.Notify(this, "EPStr");
}
}
}
private bool hastg = false;
public bool HasTimeGrid
{
get
{
return hastg;
}
set
{
if (hastg != value)
{
hastg = value;
PropertyChanged.Notify(this, "HasTimeGrid");
}
}
}
private bool hasGrid = false;
public bool HasGrid
{
get { return hasGrid; }
set
{
if (hasGrid != value)
{
hasGrid = value;
PropertyChanged.Notify(this, "HasGrid");
}
}
}
private bool hasGridAdv = false;
public bool HasGridAdv
{
get { return hasGridAdv; }
set
{
if (hasGridAdv != value)
{
hasGridAdv = value;
PropertyChanged.Notify(this, "HasGridAdv");
}
}
}
private bool hascrc = false;
public bool HasCRC
{
get { return hascrc; }
set
{
if (hascrc != value)
{
hascrc = value;
PropertyChanged.Notify(this, "HasCRC");
}
}
}
public string EPStr { get; set; } = "192.168.251.10:20006";
public bool HasTimeGrid { get; set; }
public bool HasGrid { get; set; }
public bool HasGridAdv { get; set; }
public bool HasCRC { get; set; }
public int FB_Pos1 { get; set; } = 1000;
public int FB_Pos2 { get; set; } = 3000;
private int fb_pos1 = 1000;
private int fb_pos2 = 3000;
public int FB_Pos1
{
get { return fb_pos1; }
set
{
if (fb_pos1 != value)
{
fb_pos1 = value;
PropertyChanged.Notify(this, "FB_Pos1");
}
}
}
public int FB_Pos2
{
get { return fb_pos2; }
set
{
if (fb_pos2 != value)
{
fb_pos2 = value;
PropertyChanged.Notify(this, "FB_Pos2");
}
}
}
public UInt32 Velocity;
public UInt32 SVelocity;
......@@ -121,19 +42,74 @@ namespace Flyad7_WPF
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged;
#endregion
public void Save()
{
Misc.SaveToXmlHepler.Save("param.xml", this);
try
{
DebugAppParamJsonDB param = new DebugAppParamJsonDB()
{
EPStr = EPStr,
HasTimeGrid = HasTimeGrid,
HasGrid = HasGrid,
HasGridAdv = HasGridAdv,
HasCRC = HasCRC,
FB_Pos1 = FB_Pos1,
FB_Pos2 = FB_Pos2
};
File.WriteAllText(file_path, JsonConvert.SerializeObject(param, Formatting.Indented));
}
catch
{
//异常,没有json 编码失败
}
}
string file_path = "param.json";
public void Load()
{
Misc.SaveToXmlHepler.Load("param.xml", this);
try
{
if (File.Exists(file_path))
{
string json = File.ReadAllText(file_path);
var param = JsonConvert.DeserializeObject<DebugAppParamJsonDB>(json);
EPStr = param.EPStr;
HasTimeGrid = param.HasTimeGrid;
HasGrid = param.HasGrid;
HasGridAdv = param.HasGridAdv;
HasCRC = param.HasCRC;
FB_Pos1 = param.FB_Pos1;
FB_Pos2 = param.FB_Pos2;
}
}
catch
{
//异常,没有json 解码失败
}
}
}
public class DebugAppParamJsonDB
{
public string EPStr;
public bool HasTimeGrid;
public bool HasGrid;
public bool HasGridAdv;
public bool HasCRC;
public int FB_Pos1;
public int FB_Pos2;
}
}
......@@ -10,90 +10,24 @@ namespace Flyad7_WPF
{
public class FlyADClientUI : INotifyPropertyChanged
{
private DateTime now;
public DateTime Now
{
get
{
return now;
}
set
{
if (now != value)
{
now = value;
PropertyChanged.Notify(this, "Now");
}
}
}
private int position;
public int Position
{
get { return position; }
set
{
if (position != value)
{
position = value;
PropertyChanged.Notify(this, "Position");
}
}
}
private int speed;
public int Speed
{
get { return speed; }
set
{
if (speed != value)
{
speed = value;
PropertyChanged.Notify(this, "Speed");
}
}
}
public DateTime Now { get; set; }
private int position2;
public int Position2
{
get { return position2; }
set
{
if (position2 != value)
{
position2 = value;
PropertyChanged.Notify(this, "Position2");
}
}
}
private int speed2;
public int Speed2
{
get { return speed2; }
set
{
if (speed2 != value)
{
speed2 = value;
PropertyChanged.Notify(this, "Speed2");
}
}
}
private int ad;
public int AD
{
get { return ad; }
set
{
if (ad != value)
{
ad = value;
PropertyChanged.Notify(this, "AD");
}
}
}
public int Position { get; set; }
public int Speed { get; set; }
public int Position2 { get; set; }
public int Speed2 { get; set; }
public int AD { get; set; }
private DispatcherTimer timer = new DispatcherTimer();
private FlyAD7 flyad;
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" />
<Import Project="..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props" Condition="Exists('..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
......@@ -10,12 +12,14 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flyad7_WPF</RootNamespace>
<AssemblyName>Flyad7_WPF</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -26,6 +30,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
......@@ -35,6 +40,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
......@@ -43,6 +49,15 @@
<ApplicationIcon>chip_128px_1093586_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Costura, Version=3.3.3.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.3.3.3\lib\net40\Costura.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PropertyChanged, Version=2.6.1.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\packages\PropertyChanged.Fody.2.6.1\lib\net452\PropertyChanged.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
......@@ -131,6 +146,7 @@
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......@@ -155,6 +171,15 @@
<Resource Include="chip_128px_1093586_easyicon.net.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.4.2.1\build\Fody.targets" Condition="Exists('..\packages\Fody.4.2.1\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.4.2.1\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.4.2.1\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged.Fody.2.6.1\build\PropertyChanged.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.3.3.3\build\Costura.Fody.props'))" />
</Target>
<!-- 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">
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged />
<Costura />
</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="Costura" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:all>
<xs:element minOccurs="0" maxOccurs="1" name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" maxOccurs="1" name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with line breaks.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
<xs:attribute name="CreateTemporaryAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeDebugSymbols" type="xs:boolean">
<xs:annotation>
<xs:documentation>Controls if .pdbs for reference assemblies are also embedded.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCompression" type="xs:boolean">
<xs:annotation>
<xs:documentation>Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="DisableCleanup" type="xs:boolean">
<xs:annotation>
<xs:documentation>As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="LoadAtModuleInit" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IgnoreSatelliteAssemblies" type="xs:boolean">
<xs:annotation>
<xs:documentation>Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ExcludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with |</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="IncludeAssemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged32Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 32 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Unmanaged64Assemblies" type="xs:string">
<xs:annotation>
<xs:documentation>A list of unmanaged 64 bit assembly names to include, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="PreloadOrder" type="xs:string">
<xs:annotation>
<xs:documentation>The order of preloaded assemblies, delimited with |.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<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
......@@ -19,7 +19,7 @@ namespace Flyad7_WPF.Properties {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......@@ -47,7 +47,7 @@ namespace Flyad7_WPF.Properties {
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
......
......@@ -12,7 +12,7 @@ namespace Flyad7_WPF.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
......@@ -14,6 +14,9 @@ using FlyADBase;
using System.ComponentModel;
using System.Collections.ObjectModel;
using System.Windows.Threading;
using Microsoft.Win32;
using System.IO;
using Newtonsoft.Json;
namespace Flyad7_WPF
{
......@@ -63,87 +66,24 @@ namespace Flyad7_WPF
#region 参数
int pos1lcshift;
public int Pos1LCShift
{
get { return pos1lcshift; }
set
{
if (pos1lcshift != value)
{
pos1lcshift = value;
NotifyPropertyChanged("Pos1LCShift");
}
}
}
int position2;
public int Position2
{
get { return position2; }
set
{
if (position2 != value)
{
position2 = value;
NotifyPropertyChanged("Position2");
}
}
}
int pos2shift;
public int Pos1LCShift { get; set; }
public int Pos2Shift
{
get { return pos2shift; }
set
{
if (pos2shift != value)
{
pos2shift = value;
NotifyPropertyChanged("Pos2Shift");
}
}
}
float pos2comp;
public float Pos2Comp
{
get { return pos2comp; }
set
{
if (pos2comp != value)
{
pos2comp = value;
NotifyPropertyChanged("Pos2Comp");
}
}
}
int distance;
public int Position2 { get; set; }
public int Distance
{
get { return distance; }
set
{
if (distance != value)
{
distance = value;
NotifyPropertyChanged("Distance");
}
}
}
#endregion
public int Pos2Shift { get; set; }
public float Pos2Comp { get; set; }
public int Distance { get; set; }
#endregion
protected void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void button_setPos1LCShift_Click(object sender, RoutedEventArgs e)
......@@ -304,10 +244,111 @@ namespace Flyad7_WPF
mAutoSync.StopTest();
}
private void button_save_Click(object sender, RoutedEventArgs e)
{
if (flyad.SyncOrders.Count() == 0)
{
MessageBox.Show("没有任何一条指令","错误", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
var syncOrderJsonDBs =
(from o in flyad.SyncOrders
select
new SyncOrderJsonDB()
{
type = o.GetType().Name,
syncOrderJson = Newtonsoft.Json.JsonConvert.SerializeObject(o)
}).ToList();
if (!Directory.Exists("sync_order_list"))
{
Directory.CreateDirectory("sync_order_list");
}
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.InitialDirectory = System.Environment.CurrentDirectory + @"\sync_order_list";
sfd.AddExtension = true;
sfd.DefaultExt = ".json";
if (sfd.ShowDialog() == true)
{
try
{
File.WriteAllText(sfd.FileName, JsonConvert.SerializeObject(syncOrderJsonDBs, Formatting.Indented));
}
catch(Exception _e)
{
//异常,没有json 编码失败
MessageBox.Show(_e.ToString(), "错误", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
MessageBox.Show($"保存 {syncOrderJsonDBs.Count()}条同步指令 到 {sfd.FileName}", "成功", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
private void button_load_Click(object sender, RoutedEventArgs e)
{
List<Type> ordertypes = new List<Type> {
typeof(SyncOrder_SyncRunAtLC),
typeof(SyncOrder_SyncOrigin),
typeof(SyncOrder_SyncRunTo),
typeof(SyncOrder_SyncRunToLC),
typeof(SyncOrder_SyncWait)
};
if (!Directory.Exists("sync_order_list"))
{
Directory.CreateDirectory("sync_order_list");
}
OpenFileDialog ofd = new OpenFileDialog();
ofd.InitialDirectory = System.Environment.CurrentDirectory+@"\sync_order_list";
ofd.Filter = "json|*.json";
if (ofd.ShowDialog() == true)
{
try
{
List<SyncOrder> syncorders = new List<SyncOrder>();
string json = File.ReadAllText(ofd.FileName);
var syncOrderJsonDBs = JsonConvert.DeserializeObject<List<SyncOrderJsonDB>>(json);
foreach(var syncOrderJsonDB in syncOrderJsonDBs)
{
Type t = ordertypes.Find(type => type.Name == syncOrderJsonDB.type);
if (t == null)
{
MessageBox.Show($"{syncOrderJsonDB.type} 不能识别", "异常", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
var syncorder = JsonConvert.DeserializeObject(syncOrderJsonDB.syncOrderJson, t) as SyncOrder;
syncorders.Add(syncorder);
}
flyad.SyncClear();
foreach (var syncorder in syncorders)
{
syncorder.Add(flyad);
}
MessageBox.Show($"加载 {syncorders.Count()}条同步指令", "成功", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
catch(Exception _e)
{
//异常,没有json 解码失败
MessageBox.Show($"{_e.Message}", "异常", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
}
}
}
public class SyncOrderJsonDB
{
public string type;
public string syncOrderJson;
}
......
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="3.3.3" targetFramework="net462" />
<package id="Fody" version="4.2.1" targetFramework="net462" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net462" />
<package id="PropertyChanged.Fody" version="2.6.1" targetFramework="net462" />
</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