CLI tool for running Playbooks
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

using System;
using System.Threading.Tasks;
using TrustedUninstaller.Shared.Tasks;
using YamlDotNet.Serialization;
namespace TrustedUninstaller.Shared.Actions
{
public class WriteStatusAction : TaskAction, ITaskAction
{
public void RunTaskOnMainThread() { throw new NotImplementedException(); }
[YamlMember(typeof(string), Alias = "status")]
public string Status { get; set; }
private bool InProgress { get; set; }
public void ResetProgress() => InProgress = false;
public string ErrorString() => "";
public int GetProgressWeight() => 0;
public UninstallTaskStatus GetStatus()
{
if (InProgress)
{
return UninstallTaskStatus.InProgress;
}
return hasCompleted ? UninstallTaskStatus.Completed : UninstallTaskStatus.ToDo;
}
private bool hasCompleted;
public async Task<bool> RunTask()
{
if (String.IsNullOrEmpty(Status))
{
Console.WriteLine(":AME-STATUS: " + "Running actions");
}
else
{
Console.WriteLine(":AME-STATUS: " + Status);
}
hasCompleted = true;
return true;
}
}
}