示例#1
0
        /// <summary>
        /// Remove _value to the current currency value.
        /// Fires the CurrencyManager events if _fireCallbacks is set to true.
        /// </summary>
        /// <param name="_value"></param>
        /// <param name="_fireCallbacks"></param>
        /// <returns>true if the _value has been successfully removed</returns>
        public void Remove(double _value, bool _fireCallbacks = true)
        {
            double intValue = _value - _value % 1;

            bool isAmountAvailable = IsAmountAvailable(intValue);

            if (isAmountAvailable)
            {
                currentAmount -= intValue;
            }

            if (_fireCallbacks)
            {
                if (isAmountAvailable)
                {
                    OnCurrencyRemovedSuccess?.Invoke(this);
                    CurrencyChanged();
                }
                else
                {
                    OnCurrencyRemovedFailed?.Invoke(this);
                }
            }
        }
 private void OnCurrencyRemovedFailedInvoker(Currency _currency)
 {
     OnCurrencyRemovedFailed?.Invoke(_currency);
 }