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

修复 GM_XXX Start重入

parent d8770658
...@@ -22,8 +22,15 @@ namespace FLY.Thick.Base.Server ...@@ -22,8 +22,15 @@ namespace FLY.Thick.Base.Server
} }
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.SetVelocity(Velocity); mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMin(); mFlyAD.RuntoMin();
} }
......
...@@ -63,9 +63,7 @@ namespace FLY.Thick.Base.Server ...@@ -63,9 +63,7 @@ namespace FLY.Thick.Base.Server
} }
public virtual void Stop() public virtual void Stop()
{ {
FObjBase.PollModule.Current.Poll_Config( FObjBase.PollModule.Current.Poll_Remove(onpoll_func);
FObjBase.PollModule.POLL_CONFIG.REMOVE,
onpoll_func);
IsRunning = false; IsRunning = false;
} }
......
...@@ -21,8 +21,16 @@ namespace FLY.Thick.Base.Server ...@@ -21,8 +21,16 @@ namespace FLY.Thick.Base.Server
} }
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.SetVelocity(Velocity); mFlyAD.SetVelocity(Velocity);
mFlyAD.RuntoMax(); mFlyAD.RuntoMax();
} }
......
...@@ -94,9 +94,14 @@ namespace FLY.Thick.Base.Server ...@@ -94,9 +94,14 @@ namespace FLY.Thick.Base.Server
/// </summary> /// </summary>
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) if (!IsRunning)
return; return;//运行不起来
Progress = 0; Progress = 0;
DataOK = false; DataOK = false;
......
...@@ -27,8 +27,14 @@ namespace FLY.Thick.Base.Server ...@@ -27,8 +27,14 @@ namespace FLY.Thick.Base.Server
} }
public void Start(int pos) public void Start(int pos)
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.SetVelocity(Velocity); mFlyAD.SetVelocity(Velocity);
mFlyAD.Runto(pos); mFlyAD.Runto(pos);
......
...@@ -12,9 +12,16 @@ namespace FLY.Thick.Base.Server ...@@ -12,9 +12,16 @@ namespace FLY.Thick.Base.Server
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) if (!IsRunning)
return; return;//运行不起来
mFlyAD.Origin(); mFlyAD.Origin();
} }
} }
......
...@@ -108,8 +108,15 @@ namespace FLY.Thick.Base.Server ...@@ -108,8 +108,15 @@ namespace FLY.Thick.Base.Server
} }
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mState = STATE.WAIT_ORG; mState = STATE.WAIT_ORG;
mFlyAD.Origin(); mFlyAD.Origin();
} }
......
...@@ -141,9 +141,14 @@ namespace FLY.Thick.Base.Server ...@@ -141,9 +141,14 @@ namespace FLY.Thick.Base.Server
} }
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) if (!IsRunning)
return; return;//运行不起来
Progress = 0; Progress = 0;
var group = Groups[CurrGroupIndex]; var group = Groups[CurrGroupIndex];
......
...@@ -9,6 +9,7 @@ using FlyADBase; ...@@ -9,6 +9,7 @@ using FlyADBase;
using FLY.Thick.Base.Common; using FLY.Thick.Base.Common;
using System.Diagnostics; using System.Diagnostics;
using FLY.OBJComponents.Server; using FLY.OBJComponents.Server;
using NLog;
namespace FLY.Thick.Base.Server namespace FLY.Thick.Base.Server
{ {
...@@ -177,7 +178,7 @@ namespace FLY.Thick.Base.Server ...@@ -177,7 +178,7 @@ namespace FLY.Thick.Base.Server
} }
else else
{ {
warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL,accessory: "ManualStop"); warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL, accessory: "ManualStop");
Stop(); Stop();
} }
return false; return false;
...@@ -236,10 +237,10 @@ namespace FLY.Thick.Base.Server ...@@ -236,10 +237,10 @@ namespace FLY.Thick.Base.Server
} }
else else
{ {
warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL,accessory: "ManualStopAtHome"); warningSystem.Update(ERRNOs.ERRNO_SCAN_FATAL, accessory: "ManualStopAtHome");
Stop(); Stop();
} }
}break; } break;
} }
return false; return false;
} }
...@@ -491,6 +492,4 @@ namespace FLY.Thick.Base.Server ...@@ -491,6 +492,4 @@ namespace FLY.Thick.Base.Server
} }
} }
} }
} }
...@@ -16,8 +16,15 @@ namespace FLY.Thick.Base.Server ...@@ -16,8 +16,15 @@ namespace FLY.Thick.Base.Server
} }
public override void Start() public override void Start()
{ {
if (IsRunning)
return;//已经在运行
//注册onPoll定时运行
base.Start(); base.Start();
if (!IsRunning) return;
if (!IsRunning)
return;//运行不起来
mFlyAD.Stop(); mFlyAD.Stop();
} }
} }
......
...@@ -54,13 +54,15 @@ namespace FLY.Thick.Base.Server ...@@ -54,13 +54,15 @@ namespace FLY.Thick.Base.Server
/// </summary> /// </summary>
public class GageModeManager:INotifyPropertyChanged public class GageModeManager:INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged;
/// <summary> /// <summary>
/// 当前动作模式 /// 当前动作模式
/// </summary> /// </summary>
public CTRL_STATE State { get; set; } = CTRL_STATE.FIX; public CTRL_STATE State { get; set; } = CTRL_STATE.FIX;
/// <summary> /// <summary>
/// 第1个GM,就是默认值 /// 第1个GM,就是默认值; 没有任何GM运行,就会启动第1个GM
/// </summary> /// </summary>
List<IGageMode> GMs = new List< IGageMode>(); List<IGageMode> GMs = new List< IGageMode>();
...@@ -90,20 +92,28 @@ namespace FLY.Thick.Base.Server ...@@ -90,20 +92,28 @@ namespace FLY.Thick.Base.Server
{ {
IGageMode gm = sender as IGageMode; IGageMode gm = sender as IGageMode;
if (e.PropertyName == "IsRunning") if (e.PropertyName == nameof(gm.IsRunning))
{ {
if (gm.IsRunning == true) if (gm.IsRunning == true)
{ {
//GM 启动 //GM 启动
if (GMofRunning != null)//其中一个GM启动,停止上一次运行的GM if (GMofRunning != null)
{ {
//GM启动,停止上一次运行的GM
//必须先注册 当前运行 GMofRunning 为 新的GM
//再停止上一个 GM
//因为 GM.Stop 会触发 下面的停止事件, 插入 GMs[0] 动作
IGageMode g = GMofRunning; IGageMode g = GMofRunning;
GMofRunning = gm; GMofRunning = gm;
g.Stop(); g.Stop();
} }
else else
{ {
//没有上一个GM
GMofRunning = gm; GMofRunning = gm;
} }
//更新当前状态 //更新当前状态
...@@ -112,7 +122,7 @@ namespace FLY.Thick.Base.Server ...@@ -112,7 +122,7 @@ namespace FLY.Thick.Base.Server
else else
{ {
//GM 停止 //GM 停止
if (gm == GMofRunning) if (gm == GMofRunning)//就是当前在运行的GM
{ {
GMofRunning = null;//当前没有GM在运行 GMofRunning = null;//当前没有GM在运行
...@@ -122,6 +132,6 @@ namespace FLY.Thick.Base.Server ...@@ -122,6 +132,6 @@ namespace FLY.Thick.Base.Server
} }
} }
public event PropertyChangedEventHandler PropertyChanged;
} }
} }
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