mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-13 12:14:16 +01:00
feat: add LogoutEventAgingStep.cs
This commit is contained in:
parent
a8e00f91e7
commit
075a524c7d
2 changed files with 60 additions and 6 deletions
|
|
@ -9,7 +9,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
|||
/// </summary>
|
||||
internal class LoginEventAgingStep : IAgingStep
|
||||
{
|
||||
private bool isSubscribed = false;
|
||||
private bool subscribed = false;
|
||||
private bool hasPassed = false;
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
|
@ -20,16 +20,16 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
|||
{
|
||||
ImGui.Text("Log in now...");
|
||||
|
||||
if (!this.isSubscribed)
|
||||
if (!this.subscribed)
|
||||
{
|
||||
dalamud.ClientState.OnLogin += this.ClientStateOnOnLogin;
|
||||
this.isSubscribed = true;
|
||||
this.subscribed = true;
|
||||
}
|
||||
|
||||
if (this.hasPassed)
|
||||
{
|
||||
dalamud.ClientState.OnLogin -= this.ClientStateOnOnLogin;
|
||||
this.isSubscribed = false;
|
||||
this.subscribed = false;
|
||||
return SelfTestStepResult.Pass;
|
||||
}
|
||||
|
||||
|
|
@ -39,10 +39,10 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
|||
/// <inheritdoc/>
|
||||
public void CleanUp(Dalamud dalamud)
|
||||
{
|
||||
if (this.isSubscribed)
|
||||
if (this.subscribed)
|
||||
{
|
||||
dalamud.ClientState.OnLogin -= this.ClientStateOnOnLogin;
|
||||
this.isSubscribed = false;
|
||||
this.subscribed = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
using System;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
|
||||
{
|
||||
/// <summary>
|
||||
/// Test setup for the login events.
|
||||
/// </summary>
|
||||
internal class LogoutEventAgingStep : IAgingStep
|
||||
{
|
||||
private bool subscribed = false;
|
||||
private bool hasPassed = false;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name => "Test Log-In";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public SelfTestStepResult RunStep(Dalamud dalamud)
|
||||
{
|
||||
ImGui.Text("Log out now...");
|
||||
|
||||
if (!this.subscribed)
|
||||
{
|
||||
dalamud.ClientState.OnLogout += this.ClientStateOnOnLogout;
|
||||
this.subscribed = true;
|
||||
}
|
||||
|
||||
if (this.hasPassed)
|
||||
{
|
||||
dalamud.ClientState.OnLogout -= this.ClientStateOnOnLogout;
|
||||
this.subscribed = false;
|
||||
return SelfTestStepResult.Pass;
|
||||
}
|
||||
|
||||
return SelfTestStepResult.Waiting;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void CleanUp(Dalamud dalamud)
|
||||
{
|
||||
if (this.subscribed)
|
||||
{
|
||||
dalamud.ClientState.OnLogout -= this.ClientStateOnOnLogout;
|
||||
this.subscribed = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClientStateOnOnLogout(object sender, EventArgs e)
|
||||
{
|
||||
this.hasPassed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue