2007-04-28 20:54:02 +00:00
|
|
|
using System;
|
|
|
|
|
|
2008-07-21 21:12:59 +00:00
|
|
|
namespace OpenMetaverse.TestClient
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
|
|
|
|
public class BalanceCommand: Command
|
|
|
|
|
{
|
|
|
|
|
public BalanceCommand(TestClient testClient)
|
|
|
|
|
{
|
|
|
|
|
Name = "balance";
|
|
|
|
|
Description = "Shows the amount of L$.";
|
2008-07-25 08:55:36 +00:00
|
|
|
Category = CommandCategory.Other;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
|
2008-07-25 05:15:05 +00:00
|
|
|
public override string Execute(string[] args, UUID fromAgentID)
|
2007-04-28 20:54:02 +00:00
|
|
|
{
|
2008-03-12 19:50:25 +00:00
|
|
|
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;
|
2008-03-12 19:50:25 +00:00
|
|
|
Client.Self.RequestBalance();
|
2022-02-25 19:38:11 -06:00
|
|
|
string result = "Timeout waiting for balance reply";
|
2008-03-12 19:50:25 +00:00
|
|
|
if (waitBalance.WaitOne(10000, false))
|
|
|
|
|
{
|
2022-02-25 19:38:11 -06:00
|
|
|
result = Client + " has L$: " + Client.Self.Balance;
|
2009-10-16 02:53:53 +00:00
|
|
|
}
|
2022-02-25 19:38:11 -06:00
|
|
|
Client.Self.MoneyBalance -= balance;
|
2009-10-16 02:53:53 +00:00
|
|
|
return result;
|
2007-04-28 20:54:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|