feat(Immortal) Added a back button

This commit is contained in:
2022-04-01 18:15:12 -04:00
parent a9d3920237
commit 650581c9c2
5 changed files with 146 additions and 72 deletions
+29
View File
@@ -2,9 +2,12 @@
namespace Services.Website;
//TODO Move to a database folder, with EntityService, EntityFilterService
public class EntityDialogService : IEntityDialogService
{
private string? entityId = null;
private List<string> history = new List<string>();
private event Action _onChange;
@@ -23,6 +26,7 @@ public class EntityDialogService : IEntityDialogService
public void AddDialog(string id)
{
entityId = id;
history.Add(id);
NotifyDataChanged();
}
@@ -30,9 +34,29 @@ public class EntityDialogService : IEntityDialogService
public void CloseDialog()
{
entityId = null;
history.Clear();
NotifyDataChanged();
}
public void BackDialog()
{
if (history.Count > 1)
{
history.RemoveAt(history.Count - 1);
if (history.Count == 0)
{
entityId = null;
NotifyDataChanged();
return;
}
entityId = history.Last();
NotifyDataChanged();
}
}
public bool HasDialog()
@@ -40,6 +64,11 @@ public class EntityDialogService : IEntityDialogService
return entityId != null;
}
public bool HasHistory()
{
return history.Count > 1;
}
public string? GetEntityId()
{
return entityId;