예제 #1
0
 /// <summary>
 /// Construct a new instance of the MoneyBalanceReplyEventArgs object
 /// </summary>
 /// <param name="transactionID">The ID of the transaction</param>
 /// <param name="transactionSuccess">True of the transaction was successful</param>
 /// <param name="balance">The current currency balance</param>
 /// <param name="metersCredit">The meters credited</param>
 /// <param name="metersCommitted">The meters comitted</param>
 /// <param name="description">A brief description of the transaction</param>
 /// <param name="transactionInfo">Transaction info</param>
 public MoneyBalanceReplyEventArgs(UUID transactionID, bool transactionSuccess, int balance, int metersCredit, int metersCommitted, string description, TransactionInfo transactionInfo)
 {
     this.m_TransactionID = transactionID;
     this.m_Success = transactionSuccess;
     this.m_Balance = balance;
     this.m_MetersCredit = metersCredit;
     this.m_MetersCommitted = metersCommitted;
     this.m_Description = description;
     this.m_TransactionInfo = transactionInfo;
 }
예제 #2
0
        /// <summary>Process an incoming packet and raise the appropriate events</summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The EventArgs object containing the packet data</param>
        protected void MoneyBalanceReplyHandler(object sender, PacketReceivedEventArgs e)
        {
            Packet packet = e.Packet;

            if (packet.Type == PacketType.MoneyBalanceReply)
            {
                MoneyBalanceReplyPacket reply = (MoneyBalanceReplyPacket)packet;
                this.balance = reply.MoneyData.MoneyBalance;

                if (m_MoneyBalance != null)
                {
                    TransactionInfo transactionInfo = new TransactionInfo();
                    transactionInfo.TransactionType = reply.TransactionInfo.TransactionType;
                    transactionInfo.SourceID = reply.TransactionInfo.SourceID;
                    transactionInfo.IsSourceGroup = reply.TransactionInfo.IsSourceGroup;
                    transactionInfo.DestID = reply.TransactionInfo.DestID;
                    transactionInfo.IsDestGroup = reply.TransactionInfo.IsDestGroup;
                    transactionInfo.Amount = reply.TransactionInfo.Amount;
                    transactionInfo.ItemDescription =  Utils.BytesToString(reply.TransactionInfo.ItemDescription);

                    OnMoneyBalanceReply(new MoneyBalanceReplyEventArgs(reply.MoneyData.TransactionID,
                        reply.MoneyData.TransactionSuccess,
                        reply.MoneyData.MoneyBalance,
                        reply.MoneyData.SquareMetersCredit,
                        reply.MoneyData.SquareMetersCommitted,
                        Utils.BytesToString(reply.MoneyData.Description),
                        transactionInfo));
                }
            }

            if (m_Balance != null)
            {
                OnBalance(new BalanceEventArgs(balance));
            }
        }