Ejemplo n.º 1
0
 protected virtual void Dispose(bool disposing)
 {
     if (this.handle != 0)
     {
         InAppPurchaseDialog.ReleaseNative(257, this.handle);
     }
     this.handle = 0;
 }
Ejemplo n.º 2
0
        public void Abort()
        {
            int errorCode = InAppPurchaseDialog.AbortNative(257, this.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
        }
Ejemplo n.º 3
0
        public InAppPurchaseDialog()
        {
            int errorCode = InAppPurchaseDialog.NewNative(257, out this.handle);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.productList = new InAppPurchaseProductList();
            this.busyStatus  = true;
            this.CheckResult();
        }
Ejemplo n.º 4
0
        public void GetTicketInfo()
        {
            InAppPurchaseDialog.CommandArguments commandArguments;
            commandArguments.Command   = InAppPurchaseCommand.GetTicketInfo;
            commandArguments.Arguments = null;
            int errorCode = InAppPurchaseDialog.OpenNative(257, this.handle, ref commandArguments);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.command    = commandArguments.Command;
            this.arguments  = null;
            this.busyStatus = true;
        }
Ejemplo n.º 5
0
        public void GetProductInfo(string[] labels)
        {
            InAppPurchaseDialog.CommandArguments commandArguments;
            commandArguments.Command   = InAppPurchaseCommand.GetProductInfo;
            commandArguments.Arguments = ((labels == null) ? this.AllIndices() : this.FindLabels(labels));
            int errorCode = InAppPurchaseDialog.OpenNative(257, this.handle, ref commandArguments);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.command    = commandArguments.Command;
            this.arguments  = labels;
            this.busyStatus = true;
        }
Ejemplo n.º 6
0
        public void Consume(string label)
        {
            string[] labels = new string[]
            {
                label
            };
            InAppPurchaseDialog.CommandArguments commandArguments;
            commandArguments.Command   = InAppPurchaseCommand.Consume;
            commandArguments.Arguments = this.FindLabels(labels);
            int errorCode = InAppPurchaseDialog.OpenNative(257, this.handle, ref commandArguments);

            if (errorCode != 0)
            {
                Error.ThrowNativeException(errorCode);
            }
            this.command    = commandArguments.Command;
            this.arguments  = labels;
            this.busyStatus = true;
        }
Ejemplo n.º 7
0
 internal void CheckResult()
 {
     if (this.busyStatus)
     {
         int errorCode = InAppPurchaseDialog.GetState(257, this.handle, out this.state);
         if (errorCode != 0)
         {
             Error.ThrowNativeException(errorCode);
         }
         if (this.state != CommonDialogState.Running)
         {
             InAppPurchaseDialog.CommandResults commandResults = default(InAppPurchaseDialog.CommandResults);
             errorCode = InAppPurchaseDialog.GetResult(257, this.handle, out this.result, ref commandResults);
             if (errorCode != 0)
             {
                 Error.ThrowNativeException(errorCode);
             }
             if (this.result == CommonDialogResult.OK)
             {
                 commandResults.Results = new InAppPurchaseProductData[commandResults.Count];
                 errorCode = InAppPurchaseDialog.GetResult(257, this.handle, out this.result, ref commandResults);
                 if (errorCode != 0)
                 {
                     Error.ThrowNativeException(errorCode);
                 }
                 this.productList.Resize(commandResults.Count);
                 for (int i = 0; i < commandResults.Count; i++)
                 {
                     this.productList[i].data = commandResults.Results[i];
                 }
             }
             this.infoStatus = commandResults.InfoStatus;
             this.busyStatus = false;
         }
     }
 }