Click here to Skip to main content
15,914,221 members
Home / Discussions / C#
   

C#

 
AnswerRe: Multi programming language Pin
Richard MacCutchan4-Jun-20 6:15
mveRichard MacCutchan4-Jun-20 6:15 
AnswerRe: Multi programming language Pin
OriginalGriff4-Jun-20 6:35
mveOriginalGriff4-Jun-20 6:35 
AnswerRe: Multi programming language Pin
Pete O'Hanlon4-Jun-20 21:43
mvePete O'Hanlon4-Jun-20 21:43 
GeneralRe: Multi programming language Pin
OriginalGriff4-Jun-20 21:50
mveOriginalGriff4-Jun-20 21:50 
GeneralRe: Multi programming language Pin
Pete O'Hanlon4-Jun-20 22:02
mvePete O'Hanlon4-Jun-20 22:02 
AnswerRe: Multi programming language Pin
Patrice T5-Jun-20 13:33
mvePatrice T5-Jun-20 13:33 
QuestionMulti programming language Pin
Member 148535394-Jun-20 5:38
Member 148535394-Jun-20 5:38 
AnswerRe: Multi programming language Pin
Richard Deeming4-Jun-20 5:45
mveRichard Deeming4-Jun-20 5:45 
AnswerRe: Multi programming language Pin
OriginalGriff4-Jun-20 6:34
mveOriginalGriff4-Jun-20 6:34 
AnswerRe: Multi programming language Pin
Pete O'Hanlon4-Jun-20 21:42
mvePete O'Hanlon4-Jun-20 21:42 
GeneralRe: Multi programming language Pin
OriginalGriff4-Jun-20 21:48
mveOriginalGriff4-Jun-20 21:48 
AnswerRe: Multi programming language Pin
F-ES Sitecore5-Jun-20 2:37
professionalF-ES Sitecore5-Jun-20 2:37 
AnswerRe: Multi programming language Pin
Patrice T5-Jun-20 13:35
mvePatrice T5-Jun-20 13:35 
QuestionAre there any good apple ipad c# compilers? Pin
Ultra9603-Jun-20 1:20
Ultra9603-Jun-20 1:20 
AnswerRe: Are there any good apple ipad c# compilers? Pin
OriginalGriff3-Jun-20 1:25
mveOriginalGriff3-Jun-20 1:25 
QuestionHow can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
arnold_w2-Jun-20 5:31
arnold_w2-Jun-20 5:31 
AnswerRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
OriginalGriff2-Jun-20 5:50
mveOriginalGriff2-Jun-20 5:50 
GeneralRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
arnold_w2-Jun-20 9:40
arnold_w2-Jun-20 9:40 
AnswerRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
arnold_w2-Jun-20 22:59
arnold_w2-Jun-20 22:59 
AnswerRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
arnold_w3-Jun-20 2:39
arnold_w3-Jun-20 2:39 
AnswerRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
Gerry Schmitz3-Jun-20 6:40
mveGerry Schmitz3-Jun-20 6:40 
GeneralRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
arnold_w3-Jun-20 9:30
arnold_w3-Jun-20 9:30 
GeneralRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
kalberts3-Jun-20 10:10
kalberts3-Jun-20 10:10 
GeneralRe: How can I compile code in runtime faster than CSharpCodeProvider()).CreateCompiler().CompileAssemblyFromDom? Pin
arnold_w3-Jun-20 10:34
arnold_w3-Jun-20 10:34 
QuestionConverting InAppBilling.Plugin to Amazon Pin
Exoskeletor2-Jun-20 3:52
Exoskeletor2-Jun-20 3:52 
Hello Guys,
I have create a Android application in Xamarin and i would like to also have in on Amazon store.
It uses in App purchases
Currently im implementing those purchases with this code:
public async Task<bool> WasItemPurchased(string productId)  
{  
var billing = CrossInAppBilling.Current;  
var result = false;  
try  
{  
var connected = await billing.ConnectAsync(ItemType.InAppPurchase);  
  
if (!connected)  
{  
//Couldn't connect  
return false;  
}  
  
//check purchases  
var verify = new InAppBillingVerify();  
var purchases = await billing.GetPurchasesAsync(ItemType.InAppPurchase, verify);  
  
//check for null just incase  
if (purchases?.Any(p => p.ProductId == productId) ?? false)  
{  
//Purchase restored  
Preferences.Set(productId, true);  
return true;  
}  
else  
{  
//no purchases found  
//Toast.MakeText(this, GetString(Resource.String.Options_RestoreUnavailable), ToastLength.Long);  
return false;  
}  
}  
catch (InAppBillingPurchaseException purchaseEx)  
{  
var message = string.Empty;  
switch (purchaseEx.PurchaseError)  
{  
case PurchaseError.AppStoreUnavailable:  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_ErrorAppStoreUnavailable);  
break;  
case PurchaseError.BillingUnavailable:  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_ErrorBillingUnavailable);  
break;  
case PurchaseError.PaymentInvalid:  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_ErrorPaymentInvalid);  
break;  
case PurchaseError.PaymentNotAllowed:  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_ErrorPaymentNotAllowed);  
break;  
case PurchaseError.AlreadyOwned:  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_ErrorAlreadyOwned);  
Preferences.Set(productId, true);  
result = true;  
break;  
}  
  
//Decide if it is an error we care about  
if (string.IsNullOrWhiteSpace(message))  
return false;  
  
//Display message to user  
//Toast.MakeText(this, message, ToastLength.Long);  
}  
catch (Exception exception)  
{  
Crashes.TrackError(exception);  
//Something has gone wrong  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_ErrorAppStoreUnavailable);  
//Toast.MakeText(this, GetString(Resource.String.Options_PaidFunctions_ErrorAppStoreUnavailable), ToastLength.Long);  
}  
finally  
{  
await billing.DisconnectAsync();  
}  
  
return result;  
}  
  
public async Task<bool> PurchaseItem(string productId, string payload)  
{  
var billing = CrossInAppBilling.Current;  
try  
{  
var connected = await billing.ConnectAsync(ItemType.InAppPurchase);  
if (!connected)  
{  
//we are offline or can't connect, don't try to purchase  
return false;  
}  
  
//check purchases  
var verify = new InAppBillingVerify();  
var purchase = await billing.PurchaseAsync(productId, ItemType.InAppPurchase, payload, verify);  
  
//possibility that a null came through.  
if (purchase == null)  
{  
//did not purchase  
}  
else if (purchase.State == PurchaseState.Purchased)  
{  
//purchased!  
Preferences.Set(productId, true);  
}  
}  
catch (InAppBillingPurchaseException purchaseEx)  
{  
var message = string.Empty;  
switch (purchaseEx.PurchaseError)  
{  
case PurchaseError.AppStoreUnavailable:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorAppStoreUnavailable);  
break;  
case PurchaseError.BillingUnavailable:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorBillingUnavailable);  
break;  
case PurchaseError.PaymentInvalid:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorPaymentInvalid);  
break;  
case PurchaseError.PaymentNotAllowed:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorPaymentNotAllowed);  
break;  
case PurchaseError.AlreadyOwned:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorAlreadyOwned);  
Preferences.Set(productId, true);  
EnableOrDisableProFeatures();  
break;  
}  
  
//Decide if it is an error we care about  
if (string.IsNullOrWhiteSpace(message))  
return false;  
  
//Display message to user  
DisplayToast(message, ToastLength.Long);  
  
}  
catch (Exception exception)  
{  
Crashes.TrackError(exception);  
//Something else has gone wrong, log it  
//Debug("Issue connecting: " + ex);  
DisplayToast(GetString(Resource.String.Options_PaidFunctions_ErrorAppStoreUnavailable), ToastLength.Long);  
  
}  
finally  
{  
await billing.DisconnectAsync();  
}  
return false;  
}  
  
private async Task RestorePurchases()  
{  
var currentConnectivity = Connectivity.NetworkAccess;  
var restorePurchasesResults = new List<bool>();  
if (currentConnectivity == NetworkAccess.Internet)  
{  
restorePurchasesResults.Add(await WasItemPurchased(GetString(Resource.String.Options_PaidFunctions_PurchaseTemplatesAndMoreButtons)));  
restorePurchasesResults.Add(await WasItemPurchased(GetString(Resource.String.Options_PaidFunctions_PurchaseCustomResources)));  
restorePurchasesResults.Add(await WasItemPurchased(GetString(Resource.String.Options_PaidFunctions_PurchaseDisplayWebpageAfterVote)));  
if (restorePurchasesResults.Contains(true))  
{  
DisplayToast(GetString(Resource.String.Options_PaidFunctions_PurchasesRestored), ToastLength.Long);  
  
EnableOrDisableProFeatures();  
}  
else  
{  
if (string.IsNullOrEmpty(RestorePurchasesStatusMessage))  
RestorePurchasesStatusMessage = GetString(Resource.String.Options_PaidFunctions_PurchasesNotFound);  
DisplayToast(RestorePurchasesStatusMessage, ToastLength.Long);  
  
}  
}  
else  
{  
DisplayToast(GetString(Resource.String.Options_InternetUnavailable), ToastLength.Long);  
  
}  
}  
  
private async Task<string> GetProductPrice(string productId)  
{  
var billing = CrossInAppBilling.Current;  
try  
{  
  
var connected = await billing.ConnectAsync(ItemType.InAppPurchase);  
  
if (!connected)  
{  
//Couldn't connect  
return string.Empty;  
}  
  
//check purchases  
var item = await billing.GetProductInfoAsync(ItemType.InAppPurchase, productId);  
  
if (item != null)  
return item.ToList()[0].LocalizedPrice;  
}  
catch (InAppBillingPurchaseException purchaseEx)  
{  
var message = string.Empty;  
switch (purchaseEx.PurchaseError)  
{  
case PurchaseError.AppStoreUnavailable:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorAppStoreUnavailable);  
break;  
case PurchaseError.BillingUnavailable:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorBillingUnavailable);  
break;  
case PurchaseError.PaymentInvalid:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorPaymentInvalid);  
break;  
case PurchaseError.PaymentNotAllowed:  
message = GetString(Resource.String.Options_PaidFunctions_ErrorPaymentNotAllowed);  
break;  
}  
  
//Decide if it is an error we care about  
if (string.IsNullOrWhiteSpace(message))  
return string.Empty;  
  
//Display message to user  
DisplayToast(message, ToastLength.Long);  
  
}  
catch (Exception exception)  
{  
Crashes.TrackError(exception);  
//Something has gone wrong  
}  
finally  
{  
await billing.DisconnectAsync();  
}  
return string.Empty;  
}

And i have to do similar function for the Amazon store like the API details here:
https://developer.amazon.com/docs/cross-platform-plugins/cpp-use-the-iap-plugin-for-xamarin.html
However i dont even know where to start to convert those functions, Amazon API confuse me, can someone help me?

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.