init
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DTS.DASLib.Service.StateMachine
|
||||
{
|
||||
public class DownloadStart : DASStateSelector
|
||||
{
|
||||
private void Start()
|
||||
{
|
||||
OnEnterState();
|
||||
Status.DownloadStatusInfo.Download();
|
||||
}
|
||||
|
||||
private bool CanTransitToPrepare()
|
||||
{
|
||||
return Status.DownloadParams.ProceedWhenDone && (Status.DownloadStatusInfo.AllDASFinished || !Status.DownloadParams.RequireAllDASFinish);
|
||||
}
|
||||
|
||||
public override IDASState StateSelector()
|
||||
{
|
||||
if (CanTransitToPrepare())
|
||||
{
|
||||
return States.Instance.Prepare;
|
||||
}
|
||||
return States.Instance.Download;
|
||||
}
|
||||
|
||||
public override Action OnEntry
|
||||
{
|
||||
get => Start;
|
||||
}
|
||||
|
||||
public override State State => State.DownloadStart;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user