Files
libremetaverse/Programs/examples/TestClient/Commands/Inventory/BalanceCommand.cs
Jim Radford ba491c6a63 LIBOMV-686 Implements new event patterns based on the Microsoft Framework Design Guidelines in AgentManager
* Many other code cleanups and example updates
* BREAKING - this is a major shift in the way events are internally handled.

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3145 52acb1d6-8a22-11de-b505-999d5b087335
2009-10-16 02:53:53 +00:00

34 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using OpenMetaverse;
using OpenMetaverse.Packets;
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);
EventHandler<BalanceEventArgs> del = delegate(object sender, BalanceEventArgs e) { waitBalance.Set(); };
Client.Self.MoneyBalance += del;
Client.Self.RequestBalance();
String result = "Timeout waiting for balance reply";
if (waitBalance.WaitOne(10000, false))
{
result = Client.ToString() + " has L$: " + Client.Self.Balance;
}
Client.Self.MoneyBalance -= del;
return result;
}
}
}