40 lines
987 B
C#
40 lines
987 B
C#
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;
|
|
|
|
}
|
|
}
|