Files
libremetaverse/Programs/examples/TestClient/Commands/Inventory/BalanceCommand.cs

35 lines
991 B
C#
Raw Normal View History

using System;
namespace OpenMetaverse.TestClient
{
public class BalanceCommand: Command
{
public BalanceCommand(TestClient testClient)
{
Name = "balance";
Description = "Shows the amount of L$.";
Category = CommandCategory.Other;
}
public override string Execute(string[] args, UUID fromAgentID)
{
System.Threading.AutoResetEvent waitBalance = new System.Threading.AutoResetEvent(false);
2022-02-25 19:38:11 -06:00
void balance(object sender, BalanceEventArgs e)
{
waitBalance.Set();
}
Client.Self.MoneyBalance += balance;
Client.Self.RequestBalance();
2022-02-25 19:38:11 -06:00
string result = "Timeout waiting for balance reply";
if (waitBalance.WaitOne(10000, false))
{
2022-02-25 19:38:11 -06:00
result = Client + " has L$: " + Client.Self.Balance;
}
2022-02-25 19:38:11 -06:00
Client.Self.MoneyBalance -= balance;
return result;
}
}
}