Commit f1786314 authored by 潘栩锋's avatar 潘栩锋 🚴
parents 9455aee7 00427541
......@@ -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">
<Import Project="..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props" Condition="Exists('..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" />
<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>
......@@ -11,7 +12,7 @@
<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>
......@@ -29,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>
......@@ -38,6 +40,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
......@@ -46,8 +49,14 @@
<ApplicationIcon>games_control.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="PropertyChanged2, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\packages\PropertyChanged2.Fody.2.6.0\lib\net40\PropertyChanged2.dll</HintPath>
<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" />
......@@ -183,19 +192,15 @@
<ItemGroup>
<Resource Include="games_control.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="FodyWeavers.xml">
<SubType>Designer</SubType>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.3.3.5\build\Fody.targets" Condition="Exists('..\packages\Fody.3.3.5\build\Fody.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.3.3.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.3.5\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props'))" />
<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.
......
......@@ -18,24 +18,23 @@ namespace FLYAD7_Simulation_Wpf
public int Speed { get; set; }
public int Position2 { get; set; }
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 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();
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged2 />
<PropertyChanged />
<Costura />
</Weavers>
\ No newline at end of file
......@@ -4,7 +4,121 @@
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged2" minOccurs="0" maxOccurs="1" type="xs:anyType" />
<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>
......
......@@ -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="Fody" version="3.3.5" targetFramework="net40" developmentDependency="true" />
<package id="PropertyChanged2.Fody" version="2.6.0" targetFramework="net40" />
<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 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.168
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
......@@ -179,6 +179,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CC160EA9-7336-4902-8485-5BF918EE8F68}
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:
......
......@@ -630,7 +630,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,
}
......
......@@ -15,11 +15,11 @@ namespace Flyad7_WPF
public class AutoForwBackw : INotifyPropertyChanged
{
DispatcherTimer timer = new DispatcherTimer();
DispatcherTimer timer;
FlyAD7 flyad;
public bool FB_Enable { get; set; }
public bool FB_Enable { get; set; }
public int FB_Pos1 { get; set; } = 1000;
public int FB_Pos2 { get; set; } = 3000;
......@@ -51,6 +51,7 @@ namespace Flyad7_WPF
}
void FB_init()
{
timer = new DispatcherTimer();
timer.Interval = TimeSpan.FromSeconds(1);
timer.Tick += new EventHandler(timer_Tick);
FB_Enable = false;
......
......@@ -4,28 +4,32 @@ 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; set; }
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;
public UInt32 Velocity;
public UInt32 SVelocity;
public UInt32 ATime;
......@@ -38,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,19 +10,25 @@ namespace Flyad7_WPF
{
public class FlyADClientUI : INotifyPropertyChanged
{
public DateTime Now { get; set; }
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;
public FlyADClientUI(FlyAD7 flyad)
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props" Condition="Exists('..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" />
<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>
......@@ -11,7 +12,7 @@
<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>
......@@ -29,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>
......@@ -38,6 +40,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
......@@ -46,8 +49,14 @@
<ApplicationIcon>chip_128px_1093586_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="PropertyChanged2, Version=2.6.0.0, Culture=neutral, PublicKeyToken=ee3ee20bcf148ddd, processorArchitecture=MSIL">
<HintPath>..\packages\PropertyChanged2.Fody.2.6.0\lib\net40\PropertyChanged2.dll</HintPath>
<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" />
......@@ -161,19 +170,15 @@
<ItemGroup>
<Resource Include="chip_128px_1093586_easyicon.net.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="FodyWeavers.xml">
<SubType>Designer</SubType>
</Resource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.3.3.5\build\Fody.targets" Condition="Exists('..\packages\Fody.3.3.5\build\Fody.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.3.3.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.3.5\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PropertyChanged2.Fody.2.6.0\build\PropertyChanged2.Fody.props'))" />
<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.
......
<?xml version="1.0" encoding="utf-8"?>
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<PropertyChanged2 />
<PropertyChanged />
<Costura />
</Weavers>
\ No newline at end of file
......@@ -4,7 +4,121 @@
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="PropertyChanged2" minOccurs="0" maxOccurs="1" type="xs:anyType" />
<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>
......
......@@ -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="Fody" version="3.3.5" targetFramework="net40" developmentDependency="true" />
<package id="PropertyChanged2.Fody" version="2.6.0" targetFramework="net40" />
<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