Commit 5d83800f authored by 潘栩锋's avatar 潘栩锋 🚴

自动 调整速度,记录 TimeGridAdv

parent 52fa4a1a
...@@ -47,8 +47,8 @@ namespace FlyADBase ...@@ -47,8 +47,8 @@ namespace FlyADBase
bNeedGet = true; bNeedGet = true;
dt = DateTime.Now; dt = DateTime.Now;
} }
public bool NeedGet(DateTime now,TimeSpan delay) public bool NeedGet(DateTime now, TimeSpan delay)
{ {
if (bNeedGet) if (bNeedGet)
{ {
...@@ -74,7 +74,7 @@ namespace FlyADBase ...@@ -74,7 +74,7 @@ namespace FlyADBase
/// </summary> /// </summary>
const int ReConnectTGridMaxCnt = 3; const int ReConnectTGridMaxCnt = 3;
int last_position = int.MinValue; int last_position = int.MinValue;
...@@ -92,7 +92,7 @@ namespace FlyADBase ...@@ -92,7 +92,7 @@ namespace FlyADBase
//3秒内收不到1个timegrid ,就会重连 //3秒内收不到1个timegrid ,就会重连
PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD, PollModule.Current.Poll_Config(PollModule.POLL_CONFIG.ADD,
() => () =>
...@@ -209,7 +209,7 @@ namespace FlyADBase ...@@ -209,7 +209,7 @@ namespace FlyADBase
(e.PropertyName == "HVelocity2")) (e.PropertyName == "HVelocity2"))
{ {
FObjBase.PollModule.Current.Poll_JustOnce( FObjBase.PollModule.Current.Poll_JustOnce(
delegate() delegate ()
{ {
//TODO,不应该直接修改Velocity,SVelocity。。。。。。 //TODO,不应该直接修改Velocity,SVelocity。。。。。。
//所以下面也不可能存在!!! //所以下面也不可能存在!!!
...@@ -220,7 +220,7 @@ namespace FlyADBase ...@@ -220,7 +220,7 @@ namespace FlyADBase
(e.PropertyName == "JogVelocity")) (e.PropertyName == "JogVelocity"))
{ {
FObjBase.PollModule.Current.Poll_JustOnce( FObjBase.PollModule.Current.Poll_JustOnce(
delegate() delegate ()
{ {
CurrObjSys.SetValueEx(conn, FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.ID, CurrObjSys.SetValueEx(conn, FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.ID,
ID, FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.SET_ZERO_POS, ID, FLYAD7_OBJ_INTERFACE.SYS_DATA_INTERFACE.SET_ZERO_POS,
...@@ -237,14 +237,14 @@ namespace FlyADBase ...@@ -237,14 +237,14 @@ namespace FlyADBase
(e.PropertyName == "Ratio02")) (e.PropertyName == "Ratio02"))
{ {
FObjBase.PollModule.Current.Poll_JustOnce( FObjBase.PollModule.Current.Poll_JustOnce(
delegate() delegate ()
{ {
SetSysParam(PosOfGrid, MotorType, Ratio01, Ratio02); SetSysParam(PosOfGrid, MotorType, Ratio01, Ratio02);
}, this, MARKNO_SET_SYSPARAM); }, this, MARKNO_SET_SYSPARAM);
} }
else if (e.PropertyName == "Pos1LCShift") else if (e.PropertyName == "Pos1LCShift")
{ {
CurrObjSys.CallFunctionEx( CurrObjSys.CallFunctionEx(
conn, conn,
FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID, FLYAD7_OBJ_INTERFACE.DRIVE_MAN_INTERFACE.ID,
...@@ -370,7 +370,7 @@ namespace FlyADBase ...@@ -370,7 +370,7 @@ namespace FlyADBase
if (IsConnected) if (IsConnected)
{ {
ConnectCnt++; ConnectCnt++;
Init(); Init();
} }
else else
...@@ -410,8 +410,8 @@ namespace FlyADBase ...@@ -410,8 +410,8 @@ namespace FlyADBase
break; break;
Position2 = pack.pos2; Position2 = pack.pos2;
if(!IsCalSpeed) if (!IsCalSpeed)
Speed2 = pack.speed2; Speed2 = pack.speed2;
} }
break; break;
...@@ -596,6 +596,11 @@ namespace FlyADBase ...@@ -596,6 +596,11 @@ namespace FlyADBase
} }
} }
TSysTick mSysTick = new TSysTick(); TSysTick mSysTick = new TSysTick();
private int pos1_version { get; set; } = 2;
private int io_version { get; set; } = 2;
private int timegrid_version { get; set; } = 2;
private int grid_version { get; set; } = 2;
public override void PushInfo(IFConn from, uint srcid, ushort infoid, byte[] infodata) public override void PushInfo(IFConn from, uint srcid, ushort infoid, byte[] infodata)
{ {
bShieldSetValueEx = true; bShieldSetValueEx = true;
...@@ -605,16 +610,17 @@ namespace FlyADBase ...@@ -605,16 +610,17 @@ namespace FlyADBase
{ {
FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos1_2 pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos1_2(); FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos1_2 pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos1_2();
int version; int version;
if (!pack.TryParse_version(infodata,out version)) if (!pack.TryParse_version(infodata, out version))
break; break;
Version = version; pos1_version = version;
if(version == 1)
if (version == 1)
{ {
Position = pack.pos1; Position = pack.pos1;
if (!IsCalSpeed) if (!IsCalSpeed)
Speed = pack.speed1; Speed = pack.speed1;
} }
else if(version == 2) else if (version == 2)
{ {
Position = pack.pos1; Position = pack.pos1;
if (!IsCalSpeed) if (!IsCalSpeed)
...@@ -629,9 +635,8 @@ namespace FlyADBase ...@@ -629,9 +635,8 @@ namespace FlyADBase
{ {
FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos2_2 pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos2_2(); FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos2_2 pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushPos2_2();
int version; int version;
if (!pack.TryParse_version(infodata,out version)) if (!pack.TryParse_version(infodata, out version))
break; break;
Version = version;
Position2 = pack.pos2; Position2 = pack.pos2;
if (!IsCalSpeed) if (!IsCalSpeed)
Speed2 = pack.speed2; Speed2 = pack.speed2;
...@@ -651,8 +656,8 @@ namespace FlyADBase ...@@ -651,8 +656,8 @@ namespace FlyADBase
int version; int version;
if (!pack.TryParse_version(infodata, out version)) if (!pack.TryParse_version(infodata, out version))
break; break;
Version = version; io_version = version;
if (version == 1) if (version == 1)
{ {
UInt16 inchange = (UInt16)(IStatus ^ pack.istatus); UInt16 inchange = (UInt16)(IStatus ^ pack.istatus);
IStatus = pack.istatus; IStatus = pack.istatus;
...@@ -669,13 +674,13 @@ namespace FlyADBase ...@@ -669,13 +674,13 @@ namespace FlyADBase
Position, Position,
Position2)); Position2));
} }
else if(version == 2) else if (version == 2)
{ {
IStatus = pack.istatus; IStatus = pack.istatus;
OStatus = pack.ostatus; OStatus = pack.ostatus;
DateTime dt = mSysTick.ToDateTime(pack.systick); DateTime dt = mSysTick.ToDateTime(pack.systick);
Now = dt; Now = dt;
IStatusChangedEvent?.Invoke( IStatusChangedEvent?.Invoke(
this, this,
new IStatusChangedEventArgs( new IStatusChangedEventArgs(
...@@ -684,7 +689,7 @@ namespace FlyADBase ...@@ -684,7 +689,7 @@ namespace FlyADBase
pack.inChange, pack.inChange,
pack.pos1, pack.pos1,
pack.pos2)); pack.pos2));
} }
advPushIo(pack.pos1); advPushIo(pack.pos1);
} break; } break;
...@@ -702,7 +707,7 @@ namespace FlyADBase ...@@ -702,7 +707,7 @@ namespace FlyADBase
{ {
break; break;
} }
Version = version; timegrid_version = version;
DateTime dt; DateTime dt;
int[] data; int[] data;
...@@ -743,7 +748,6 @@ namespace FlyADBase ...@@ -743,7 +748,6 @@ namespace FlyADBase
FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushStatus_2 pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushStatus_2(); FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushStatus_2 pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushStatus_2();
if (!pack.TryParse_version(infodata, out version)) if (!pack.TryParse_version(infodata, out version))
break; break;
Version = version;
if (version == 1) if (version == 1)
{ {
DriveOrder = pack.order; DriveOrder = pack.order;
...@@ -752,7 +756,7 @@ namespace FlyADBase ...@@ -752,7 +756,7 @@ namespace FlyADBase
else if (version == 2) else if (version == 2)
{ {
DriveOrder = pack.order; DriveOrder = pack.order;
DriveStatus = pack.status; DriveStatus = pack.status;
Marker = pack.marker; Marker = pack.marker;
DateTime dt = mSysTick.ToDateTime(pack.systick); DateTime dt = mSysTick.ToDateTime(pack.systick);
...@@ -763,9 +767,9 @@ namespace FlyADBase ...@@ -763,9 +767,9 @@ namespace FlyADBase
{ {
int version; int version;
var pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushGrid_2(); var pack = new FLYAD7_OBJ_INTERFACE.PUSH_DATA_INTERFACE.Pack_PushGrid_2();
if (!pack.TryParse_version(infodata,out version)) if (!pack.TryParse_version(infodata, out version))
break; break;
grid_version = version;
DateTime dt; DateTime dt;
int marker; int marker;
if (version == 1) if (version == 1)
...@@ -850,7 +854,7 @@ namespace FlyADBase ...@@ -850,7 +854,7 @@ namespace FlyADBase
} }
} }
if (sysinfo_wait.NeedGet(now,TimeSpan.FromSeconds(1))) if (sysinfo_wait.NeedGet(now, TimeSpan.FromSeconds(1)))
{ {
CurrObjSys.GetValueEx( CurrObjSys.GetValueEx(
conn, conn,
...@@ -874,7 +878,7 @@ namespace FlyADBase ...@@ -874,7 +878,7 @@ namespace FlyADBase
// } // }
//} //}
//else //else
if(driveman_wait.NeedGet(now, TimeSpan.FromSeconds(3)))//每3秒检查一次 if (driveman_wait.NeedGet(now, TimeSpan.FromSeconds(3)))//每3秒检查一次
{ {
driveman_wait.Clear(); driveman_wait.Clear();
if (Position == last_position)//当前正在running,但脉冲在3秒内都没变化,问AD卡,现在什么情况。 if (Position == last_position)//当前正在running,但脉冲在3秒内都没变化,问AD卡,现在什么情况。
...@@ -890,7 +894,7 @@ namespace FlyADBase ...@@ -890,7 +894,7 @@ namespace FlyADBase
} }
} }
#region INotifyPropertyChanged 成员 #region INotifyPropertyChanged 成员
protected void NotifyPropertyChanged(string propertyName) protected void NotifyPropertyChanged(string propertyName)
...@@ -937,7 +941,17 @@ namespace FlyADBase ...@@ -937,7 +941,17 @@ namespace FlyADBase
/// <summary> /// <summary>
/// AD盒版本号 版本1 没有systick;版本2 有systick; /// AD盒版本号 版本1 没有systick;版本2 有systick;
/// </summary> /// </summary>
public int Version { get; private set; } = 2; public int Version
{
get {
if (pos1_version == 2
&& timegrid_version == 2
&& grid_version == 2)
return 2;
else
return 1;
}
}
/// <summary> /// <summary>
/// 脉冲 /// 脉冲
......
using FlyADBase;
using GalaSoft.MvvmLight.Command;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace Flyad7_WPF
{
[JsonObject(MemberSerialization.OptIn)]
public class AutoGetGridAdv:INotifyPropertyChanged
{
FlyAD7 flyad;
public bool IsError { get; set; }
public string ErrMsg { get; set; }
public string ProgressMsg { get; set; }
public bool IsRunning { get; private set; }
[JsonProperty]
public int FB_Pos1 { get; set; } = 1000;
[JsonProperty]
public int FB_Pos2 { get; set; } = 3000;
[JsonProperty]
public int StartV { get; set; } = 100;
[JsonProperty]
public int StepV { get; set; } = 100;
[JsonProperty]
public int EndV { get; set; } = 2000;
public RelayCommand StartCmd { get; private set; }
public RelayCommand StopCmd { get; private set; }
List<IEnumerable<GridAdvUnit>> gridAdvUnits = new List<IEnumerable<GridAdvUnit>>();
public AutoGetGridAdv()
{
StartCmd = new RelayCommand(Start);
StopCmd = new RelayCommand(Stop);
Load();
}
public void Init(FlyAD7 flyad)
{
this.PropertyChanged += AutoSave;
this.flyad = flyad;
}
CancellationTokenSource cancellationTokenSource;
public async void Start()
{
if (IsRunning)
return;
cancellationTokenSource = new CancellationTokenSource();
IsError = false;
IsRunning = true;
ProgressMsg = "准备动作,到达 开始位置";
await Task.Delay(1);
flyad.SetVelocity((UInt32)(StartV + EndV) / 2);
flyad.Runto(FB_Pos1);
if (!await Wait()) goto _end;
ProgressMsg = "正式开始";
await Task.Delay(1);
//正式开始
gridAdvUnits.Clear();
flyad.TimeGridAdvEvent += Flyad_TimeGridAdvEvent;
int v = StartV;
int cnt = (EndV - StartV) / StepV;
for(int j=0;j<cnt;j++)
{
flyad.SetVelocity((UInt32)v);
for (int i = 0; i < 2; i++)
{
ProgressMsg = $"{j*2+i}/{cnt*2} 以速度 {v}pps 来回扫描";
await Task.Delay(1);
flyad.Runto(FB_Pos2);
if (!await Wait()) goto _end;
flyad.Runto(FB_Pos1);
if (!await Wait()) goto _end;
}
v += StepV;
}
_end:
await Task.Delay(1000);//等1秒,等最后一个TimeGridAdvEvent收到
flyad.TimeGridAdvEvent -= Flyad_TimeGridAdvEvent;
//保存数据
string strDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
string path = System.IO.Path.Combine(strDesktopPath, $"autoGridAdv_{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.json");
string json = Newtonsoft.Json.JsonConvert.SerializeObject(gridAdvUnits);
File.WriteAllText(path, json);
ProgressMsg = $"成功保存到 {path}";
gridAdvUnits.Clear();
IsRunning = false;
}
private void Flyad_TimeGridAdvEvent(object sender, TimeGridAdvEventArgs e)
{
gridAdvUnits.Add(e.Data);
}
async Task<bool> Wait()
{
while (true)
{
try
{
await Task.Delay(2000, cancellationTokenSource.Token);
}
catch
{
//被叫醒了
ErrMsg = "强制退出";
IsError = true;
await Task.Delay(1);
return false;
}
if (!flyad.IsConnected)
{
ErrMsg = "连接断开";
IsError = true;
await Task.Delay(1);
return false;
}
if (flyad.DriveStatus == DRIVE_MAN_STATUS.RUNNING)
{
continue;
}
else if (flyad.DriveStatus == DRIVE_MAN_STATUS.STOP)
{
return true;
}
else
{
ErrMsg = $"异常停止 flyad.DriveStatus={flyad.DriveStatus}";
IsError = true;
return false;
}
}
}
public void Stop()
{
if (!IsRunning)
return;
if (cancellationTokenSource == null)
return;
if (cancellationTokenSource.IsCancellationRequested)
return;
cancellationTokenSource.Cancel();
}
public event PropertyChangedEventHandler PropertyChanged;
private bool isIgnoreSave;
private async void AutoSave(object sender, PropertyChangedEventArgs e)
{
if (isIgnoreSave)
return;
if (this.GetType()
.GetProperty(e.PropertyName)
.GetCustomAttributes(typeof(JsonPropertyAttribute), false)
.Count() > 0)
{
isIgnoreSave = true;
await Task.Delay(5000);//Task.Yield();
Save();
isIgnoreSave = false;
}
}
void Save()
{
try
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(this);
File.WriteAllText("autoGridAdv.json", json);
}
catch (Exception e )
{
}
}
void Load()
{
try
{
string json = File.ReadAllText("autoGridAdv.json");
isIgnoreSave = true;
Newtonsoft.Json.JsonConvert.PopulateObject(json, this);
isIgnoreSave = false;
}
catch (Exception e)
{
}
}
}
}
...@@ -6,6 +6,7 @@ using System.ComponentModel; ...@@ -6,6 +6,7 @@ using System.ComponentModel;
using Misc; using Misc;
using System.IO; using System.IO;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Threading.Tasks;
namespace Flyad7_WPF namespace Flyad7_WPF
{ {
...@@ -31,51 +32,70 @@ namespace Flyad7_WPF ...@@ -31,51 +32,70 @@ namespace Flyad7_WPF
public int FB_Pos2 { get; set; } = 3000; public int FB_Pos2 { get; set; } = 3000;
public UInt32 Velocity { get; set; } public UInt32 Velocity { get; set; } = 3000;
public UInt32 SVelocity { get; set; } public UInt32 SVelocity { get; set; } = 100;
public UInt32 ATime { get; set; } public UInt32 ATime { get; set; } = 300;
public UInt32 DTime { get; set; } public UInt32 DTime { get; set; } = 300;
public UInt32 HVelocity1 { get; set; } public UInt32 HVelocity1 { get; set; } = 1000;
public UInt32 HVelocity2 { get; set; } public UInt32 HVelocity2 { get; set; } = 300;
public int PosLen; public int PosLen { get; set; } = 8900;
public int ADLag { get; set; } public int ADLag { get; set; } = 0;
#region INotifyPropertyChanged 成员
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
#endregion
public DebugAppParam()
{
Load();
}
public void Init()
{
this.PropertyChanged += AutoSave;
}
private bool isIgnoreSave;
private async void AutoSave(object sender, PropertyChangedEventArgs e)
{
if (isIgnoreSave)
return;
if (this.GetType().GetProperty(e.PropertyName).GetCustomAttributes(typeof(JsonPropertyAttribute), false).Count() > 0)
{
isIgnoreSave = true;
await Task.Delay(5000);//Task.Yield();
Save();
isIgnoreSave = false;
}
}
public void Save() public void Save()
{ {
Misc.SaveToXmlHepler.Save(file_path, this); try
{
string json = JsonConvert.SerializeObject(this);
File.WriteAllText("param.json", json);
}
catch {
}
} }
string file_path = "param.xml";
public void Load() public void Load()
{ {
Misc.SaveToXmlHepler.Load(file_path, this); try
{
string json = File.ReadAllText("param.json");
isIgnoreSave = true;
JsonConvert.PopulateObject(json, this);
isIgnoreSave = false;
}
catch {
}
} }
} }
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;
}
} }
...@@ -72,12 +72,14 @@ ...@@ -72,12 +72,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="AutoForwBackw.cs" /> <Compile Include="AutoForwBackw.cs" />
<Compile Include="AutoGetGridAdv.cs" />
<Compile Include="AutoSync.cs" /> <Compile Include="AutoSync.cs" />
<Compile Include="Converters\BinConverter.cs" /> <Compile Include="Converters\BinConverter.cs" />
<Compile Include="Converters\BytesConverter.cs" /> <Compile Include="Converters\BytesConverter.cs" />
<Compile Include="Converters\IO2BinConverter.cs" /> <Compile Include="Converters\IO2BinConverter.cs" />
<Compile Include="DebugAppParam.cs" /> <Compile Include="DebugAppParam.cs" />
<Compile Include="FlyADClientUI.cs" /> <Compile Include="FlyADClientUI.cs" />
<Compile Include="GridAdvVm.cs" />
<Compile Include="Window1.xaml.cs"> <Compile Include="Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon> <DependentUpon>Window1.xaml</DependentUpon>
</Compile> </Compile>
...@@ -184,6 +186,9 @@ ...@@ -184,6 +186,9 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="MvvmLightLibs">
<Version>5.4.1.1</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json"> <PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version> <Version>12.0.3</Version>
</PackageReference> </PackageReference>
......
This diff is collapsed.
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
</Style> </Style>
<Style TargetType="TextBlock" x:Key="TextBlockStyle_itemTitle"> <Style TargetType="TextBlock" x:Key="TextBlockStyle_itemTitle">
<Setter Property="Width" Value="60" /> <Setter Property="Width" Value="60" />
<Setter Property="Height" Value="23" />
<Setter Property="Margin" Value="3" /> <Setter Property="Margin" Value="3" />
</Style> </Style>
<Style TargetType="TextBox" x:Key="TextBoxStyle_itemContent"> <Style TargetType="TextBox" x:Key="TextBoxStyle_itemContent">
...@@ -35,8 +34,8 @@ ...@@ -35,8 +34,8 @@
</Style> </Style>
<Style TargetType="Button" x:Key="ButtonStyle"> <Style TargetType="Button" x:Key="ButtonStyle">
<Setter Property="Height" Value="30"/> <Setter Property="Height" Value="30"/>
<Setter Property="Width" Value="80"/>
<Setter Property="Margin" Value="3"/> <Setter Property="Margin" Value="3"/>
<Setter Property="Padding" Value="20,3"/>
</Style> </Style>
</ResourceDictionary> </ResourceDictionary>
</Window.Resources> </Window.Resources>
...@@ -371,28 +370,84 @@ ...@@ -371,28 +370,84 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Name="stackpanel_graph_gridadv"> <StackPanel >
<StackPanel Orientation="Horizontal" > <GroupBox Name="gbTimeGridAdv" Header="TimeGridAdv操作" d:DataContext="{d:DesignInstance Type=local:GridAdvVm}">
<CheckBox Content="接收GridAdv" IsChecked="{Binding DataContext.HasGridAdv,ElementName=grid_param}" VerticalAlignment="Center" Margin="3" />
<Button Padding="20,5" Margin="3" Content="保存GridAdv" Click="btnSaveGridAdvClick" />
<Button Padding="20,5" Margin="3" Content="读取GridAdv" Click="btnLoadGridAdvClick" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Padding="20,5" Margin="3" Content="计算滞后" Click="btnCalAdLagClick" />
<TextBlock Margin="10,0">
当前相关性=<Run Text="{Binding CurrR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock>
<StackPanel> <StackPanel>
<TextBlock Margin="10,0"> <StackPanel Orientation="Horizontal" >
<CheckBox Content="接收GridAdv" IsChecked="{Binding HasGridAdv }" VerticalAlignment="Center" Margin="3" />
<Button Style="{StaticResource ButtonStyle}" Content="保存" Command="{Binding SaveCmd}" />
<Button Style="{StaticResource ButtonStyle}" Content="读取" Command="{Binding LoadCmd}" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource ButtonStyle}" Content="计算滞后" Command="{Binding CalAdLagCmd}" />
<TextBlock Margin="10,0">
当前相关性=<Run Text="{Binding CurrR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock>
<StackPanel>
<TextBlock Margin="10,0">
计算进度 AdLag=<Run Text="{Binding ProgressOfAdLag, Mode=OneWay}"/> | R=<Run Text="{Binding ProgressOfR, StringFormat={}{0:F4}, Mode=OneWay}"/> 计算进度 AdLag=<Run Text="{Binding ProgressOfAdLag, Mode=OneWay}"/> | R=<Run Text="{Binding ProgressOfR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock> </TextBlock>
<TextBlock Margin="10,0"> <TextBlock Margin="10,0">
结果 AdLag=<Run Text="{Binding BestAdLag, Mode=OneWay}"/> | R=<Run Text="{Binding BestR, StringFormat={}{0:F4}, Mode=OneWay}"/> 结果 AdLag=<Run Text="{Binding BestAdLag, Mode=OneWay}"/> | R=<Run Text="{Binding BestR, StringFormat={}{0:F4}, Mode=OneWay}"/>
</TextBlock>
</StackPanel>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox x:Name="gbAutoGetGridAdv" Header="自动采集不同速度TimeGridAdv" d:DataContext="{d:DesignInstance Type=local:AutoGetGridAdv}" >
<StackPanel >
<StackPanel Orientation="Horizontal" >
<Button Style="{StaticResource ButtonStyle}" Content="开始" Command="{Binding StartCmd}" />
<Button Style="{StaticResource ButtonStyle}" Content="停止" Command="{Binding StopCmd}" />
<StackPanel Orientation="Horizontal">
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding FB_Pos1}" />
<TextBlock Text="&lt;----&gt;" VerticalAlignment="Center"/>
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding FB_Pos2}" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<StackPanel Margin="2">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="开始速度" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding StartV}" />
</StackPanel>
<StackPanel Margin="2">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="结束速度" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding EndV}" />
</StackPanel>
<StackPanel Margin="2">
<TextBlock Style="{StaticResource TextBlockStyle_itemTitle}" Text="步进" />
<TextBox Style="{StaticResource TextBoxStyle_itemContent}" Text="{Binding StepV}" />
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10,0">
运行中 =<Run Text="{Binding IsRunning, Mode=OneWay}"/>
</TextBlock>
<TextBlock Margin="10,0">
Error=<Run Text="{Binding ErrMsg,Mode=OneWay}" />
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding IsError}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
<TextBlock Margin="10,0">
Progess=<Run Text="{Binding ProgressMsg,Mode=OneWay}"/>
</TextBlock> </TextBlock>
</StackPanel> </StackPanel>
</StackPanel>
</GroupBox>
</StackPanel> </StackPanel>
<WindowsFormsHost Grid.Row="1"> <WindowsFormsHost Grid.Row="1">
......
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