Dalamud/Dalamud/Interface/Internal/Windows/SelfTest/AgingSteps/PartyFinderAgingStep.cs
Blair 7947b896ea
Add interfaces to non public/sealed classes referenced in public interfaces (#1808)
* Add interfaces to non public/sealed classes referenced in public interfaces

* Fixed inheritdocs + made most classes internal

* Add missing properties to IFate and Fate, fix documentation

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2024-06-28 23:05:34 +02:00

58 lines
1.4 KiB
C#

using Dalamud.Game.Gui.PartyFinder;
using Dalamud.Game.Gui.PartyFinder.Types;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
/// <summary>
/// Test setup for Party Finder events.
/// </summary>
internal class PartyFinderAgingStep : IAgingStep
{
private bool subscribed = false;
private bool hasPassed = false;
/// <inheritdoc/>
public string Name => "Test Party Finder";
/// <inheritdoc/>
public SelfTestStepResult RunStep()
{
var partyFinderGui = Service<PartyFinderGui>.Get();
if (!this.subscribed)
{
partyFinderGui.ReceiveListing += this.PartyFinderOnReceiveListing;
this.subscribed = true;
}
if (this.hasPassed)
{
partyFinderGui.ReceiveListing -= this.PartyFinderOnReceiveListing;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
ImGui.Text("Open Party Finder");
return SelfTestStepResult.Waiting;
}
/// <inheritdoc/>
public void CleanUp()
{
var partyFinderGui = Service<PartyFinderGui>.Get();
if (this.subscribed)
{
partyFinderGui.ReceiveListing -= this.PartyFinderOnReceiveListing;
this.subscribed = false;
}
}
private void PartyFinderOnReceiveListing(IPartyFinderListing listing, IPartyFinderListingEventArgs args)
{
this.hasPassed = true;
}
}