예제 #1
0
        public void StartConnection(Action <BillingResult> setupFinished, Action onDisconnected)
        {
            var listener = new InternalBillingClientStateListener
            {
                BillingServiceDisconnectedHandler = () =>
                                                    onDisconnected?.Invoke(),
                BillingSetupFinishedHandler = r =>
                                              setupFinished?.Invoke(r)
            };

            StartConnection(listener);
        }
예제 #2
0
        public Task <BillingResult> StartConnectionAsync(Action onDisconnected = null)
        {
            var tcs = new TaskCompletionSource <BillingResult>();

            var listener = new InternalBillingClientStateListener
            {
                BillingServiceDisconnectedHandler = () =>
                {
                    onDisconnected?.Invoke();
                    tcs.TrySetResult(null);
                },
                BillingSetupFinishedHandler = r =>
                                              tcs.TrySetResult(r)
            };

            StartConnection(listener);

            return(tcs.Task);
        }