Esempio n. 1
0
        private void UpdateItemDetails()
        {
            List <ItemDetailQueryInfo> completedQueries = new List <ItemDetailQueryInfo>();

            for (int i = 0; i < _pendingItemDetailQueries.Count; ++i)
            {
                ItemDetailQueryInfo          info    = _pendingItemDetailQueries[i];
                MLPurchaseItemDetailsResults results = MLPurchaseItemDetailsResults.Create();
                MLCloudStatus status = MLCloudStatus.NotDone;
                info.Details.Result = MLPurchaseNativeBindings.MLPurchaseItemDetailsGetResult(info.Handle, ref results, ref status);

                if (info.Details.Result == MLResult.Code.Ok)
                {
                    if (status == MLCloudStatus.Done)
                    {
                        info.Details.ItemResults = new MLPurchaseItemDetailsResult[results.count];
                        for (int j = 0; j < results.count; j++)
                        {
                            IntPtr offsetPtr = new IntPtr(results.itemDetails.ToInt64() + (Marshal.SizeOf(typeof(MLPurchaseItemDetailsResult)) * j));
                            info.Details.ItemResults[j] = (MLPurchaseItemDetailsResult)Marshal.PtrToStructure(offsetPtr, typeof(MLPurchaseItemDetailsResult));
                        }
                        completedQueries.Add(info);
                    }
                }
                else
                {
                    completedQueries.Add(info);
                }
            }

            PublishItemDetails(completedQueries);
        }
 public static extern MLResult.Code MLPurchaseItemDetailsGetResult(ulong itemDetailsHandle, ref MLPurchaseItemDetailsResults outItemDetailsResult, ref MLCloudStatus outStatus);