2026-05-31 19:31:27 +02:00
|
|
|
namespace AuthorBuddy.Web.Services;
|
|
|
|
|
|
|
|
|
|
public class OperationState
|
|
|
|
|
{
|
|
|
|
|
public string StatusText { get; private set; } = "Bereit";
|
|
|
|
|
public bool IsBusy { get; private set; }
|
|
|
|
|
public double Progress { get; private set; }
|
|
|
|
|
public string ThoughtText { get; private set; } = "";
|
|
|
|
|
|
|
|
|
|
public event Action? OnChange;
|
|
|
|
|
|
|
|
|
|
public void SetStatus(string text, bool busy = false, double progress = 0)
|
|
|
|
|
{
|
|
|
|
|
StatusText = text;
|
|
|
|
|
IsBusy = busy;
|
|
|
|
|
Progress = progress;
|
|
|
|
|
Notify();
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-30 08:11:01 +02:00
|
|
|
public void SetBusy(bool busy)
|
|
|
|
|
{
|
|
|
|
|
IsBusy = busy;
|
|
|
|
|
Notify();
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-31 19:31:27 +02:00
|
|
|
public void SetThought(string text)
|
|
|
|
|
{
|
|
|
|
|
ThoughtText = text;
|
|
|
|
|
Notify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void AppendThought(string text)
|
|
|
|
|
{
|
|
|
|
|
ThoughtText += text;
|
|
|
|
|
Notify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Reset()
|
|
|
|
|
{
|
|
|
|
|
StatusText = "Bereit";
|
|
|
|
|
IsBusy = false;
|
|
|
|
|
Progress = 0;
|
|
|
|
|
ThoughtText = "";
|
|
|
|
|
Notify();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Notify() => OnChange?.Invoke();
|
|
|
|
|
}
|