Exemplo n.º 1
0
        public static IEnumerator GetExchangeRate(
            Client client,
            string exchangeNamespaceName,
            GetExchangeRateEvent onGetExchangeRate,
            ErrorEvent onError
            )
        {
            AsyncResult <EzListRateModelsResult> result = null;

            yield return(client.Exchange.ListRateModels(
                             r => { result = r; },
                             exchangeNamespaceName
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var rateModels = result.Result.Items;

            onGetExchangeRate.Invoke(exchangeNamespaceName, rateModels);
        }
Exemplo n.º 2
0
        public IEnumerator Run(
            Client client,
            GameSession session,
            string exchangeNamespaceName,
            GetExchangeRateEvent onGetExchangeRate,
            ErrorEvent onError
            )
        {
            if (_watching)
            {
                throw new InvalidOperationException("already started");
            }

            _watching = true;

            _client  = client;
            _session = session;

            _exchangeNamespaceName = exchangeNamespaceName;
            _onGetExchangeRate     = onGetExchangeRate;
            _onError = onError;

            yield return(Refresh());
        }