From e834160cd3f8a4dd98e31a77834c8ff36c581aec Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Fri, 2 Aug 2024 15:51:49 +0200 Subject: [PATCH] Show last updated time on Inventory tab --- ARControl/ARControl.csproj | 2 +- ARControl/Windows/Config/InventoryTab.cs | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ARControl/ARControl.csproj b/ARControl/ARControl.csproj index f86814f..109156a 100644 --- a/ARControl/ARControl.csproj +++ b/ARControl/ARControl.csproj @@ -1,6 +1,6 @@ - 5.6 + 5.7 dist diff --git a/ARControl/Windows/Config/InventoryTab.cs b/ARControl/Windows/Config/InventoryTab.cs index 399079b..883b9ce 100644 --- a/ARControl/Windows/Config/InventoryTab.cs +++ b/ARControl/Windows/Config/InventoryTab.cs @@ -22,6 +22,7 @@ internal sealed class InventoryTab : ITab private readonly IPluginLog _pluginLog; private List? _listAsTrees; + private DateTime? _lastUpdate; public InventoryTab(Configuration configuration, AllaganToolsIpc allaganToolsIpc, GameCache gameCache, IPluginLog pluginLog) @@ -38,6 +39,7 @@ internal sealed class InventoryTab : ITab if (!tab) { _listAsTrees = null; + _lastUpdate = null; return; } @@ -47,6 +49,16 @@ internal sealed class InventoryTab : ITab if (ImGuiComponents.IconButtonWithText(FontAwesomeIcon.Redo, "Refresh")) RefreshInventory(); + if (_lastUpdate != null) + { + string text = $"Last Update: {_lastUpdate:t}"; + ImGui.SameLine(); + + ImGui.SameLine(ImGui.GetContentRegionAvail().X - ImGui.CalcTextSize(text).X + ImGui.GetCursorPosX()); + ImGui.AlignTextToFramePadding(); + ImGui.TextColored(ImGuiColors.DalamudGrey, text); + } + ImGui.Separator(); if (_listAsTrees == null || _listAsTrees.Count == 0) @@ -167,6 +179,7 @@ internal sealed class InventoryTab : ITab } _listAsTrees = listAsTrees; + _lastUpdate = DateTime.Now; } catch (Exception e) {