Plugin.InAppBilling.PurchaseAsync never returns - c#

I am attempting to use the InAppBilling plugin to make purchases on Android and I am using the code described here: https://jamesmontemagno.github.io/InAppBillingPlugin/PurchaseNonConsumable.html
Everything seems to work correctly and I am able to complete the purchase. However the await PurchaseAsync call never returns after the purchase is complete. The purchase does go through, however, and if I later call the GetPurchasesAsync function, it shows that I do own the item.
Any ideas as to what I might be doing wrong would be appreciated.
Thanks.

I apparently did not read the documentation properly and was missing the OnActivityResult override in the MainActivity.

Related

The latest version (6.0.20) of Akavache seems to be partly broken when used in Xamarin.iOS?

I was originally trying to fetch and cache an image using BlobCache.LocalMachine.LoadImageFromUrl(someURL), but I found that it
just stopped responding after I called this method. (Yes, I've set BlobCache.ApplicationName, I even called BlobCache.EnsureInitialized(), and the SQL3 lib wasn't stripped by the linker.) So I did some experiments and tried to find out what was wrong.
After several hours of testing I found that only these methods should work in my circumstances:
1.
BlobCache.LocalMachine.DownloadUrl(someURL).Wait(); // Can fetch the right image file but it won't store it into cache; The cache disappears if I restart the app
var image = BlobCache.LocalMachine.LoadImage(someURL).Wait().ToNative(); // This part is good
2.
BlobCache.LocalMachine.InsertObject<string>(key, value).Wait();
var value = BlobCache.LocalMachine.GetObject<string>(key).Wait(); // This functions well; I can get the correct value right away after a restart
Also, whenever I use await in my code, it falls to infinite deadlock(?). Say, var value = await BlobCache.LocalMachine.GetObject<string>(key);. (Of course I've imported System.Reactive.Linq.) The possible workaround to me is to use wait() or subscribe() instead.
BlobCache.LocalMachine.GetOrFetchObject() won't work either.
P.S.: I have the latest Xamarin.iOS & Mono build on my VS Mac.
So did I miss anything that's important when using Akavache in Xamarin.iOS?
Please enlighten me.🤭
I've posted an issue here.

How do I cancel recent prints with printDocument.print() in C#?

I have a C# application that prints simple texts correctly with printDocument Class.
The problem is that I want to cancel recent print jobs or Remove them or Purge print queue, before call a new .print() function!
I don't know what I have to do that, it seems PrintDocument doesn't push print jobs onto printer queue! because I dont see any job there.
thanks for help to "clear recent print jobs created with printDocumnet.print()"
Ali.
You should be able to with WMI as long as you have the rights
http://sandit27.wordpress.com/2008/05/12/how-to-cancel-printing-in-c/
I did a lot of work with printers a while back and the way that I achieved most of the functionality I wanted was through PInvoke.
As the answer from #Tsukasa states you "can" use WMI but that's another nightmare that's very difficult to deal with if you plan on actually deploying your solution anywhere other than your own machine.
As I'd mentioned: my suggestion would be to look into PInvoke. Keep in mind though that it has been a number of years/.NET Framework versions since I've worked in the print industry so Microsoft may have released a more elegant, easy-to-use solution that is native to .NET.
Here is a list of Print Spooler functions from the MSDN
Basically what you're going to want to do if you go this route is this:
Find the named handle to the print device in the Registry. This can be done with the registry classes available in the .NET framework. The name of the printer to windows will start with a "#" (or two) followed by some garbled junk and then a GUID. The key where all your printers are installed in the registry is here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers
Call OpenPrinter with the printer name.
Call EnumJobs with the handle retrieved from OpenPrinter.
Call SetJob passing the Job Id retrieved from EnumJobs for the job you want to cancel. Be sure to pass the JOB_CONTROL_DELETE Flag to cancel the job.
Call ClosePrinter, passing the handle retrieved from OpenPrinter. Don't forget this step. Windows/The print spooler gets very cranky if you do.
Again I can't stress enough that there is most-likely a better, more .NET way to do this. I suggest exhausting your options there first.
Good luck.

Exchange Web Service Managed API: How to get Task from E-Mail?

I am using EWS to get some E-Mails, everything works fine but now i have to implement the "CompleteDate" which is set when someone uses this Red Flag in Outlook to set it to a Task.
I searched everything but i dont find a way to get the task from the E-Mail.. i tried to bind the Mail as a Task but id didnt work:
Task task = Task.Bind(service, item.Id);
Could anyone help me out here?
What can help is make use of IlSpy for viewing the DLL.
A other great tool is EWSEditor. Its free and you can use it to read items based on EWS.
A e-mail cant be a task, you dont have the properties for the task.
To get the task you need to search by subject.
See example: http://code.msdn.microsoft.com/Exchange-2013-Find-tasks-0d2633ec
(With coding example)

SharpPcap OnPcapStatistics event never fires?

I am trying to get SharpPcap Statistics to work, but the OnPcapStatistics event never fires.
Here's the code: SharpPcap Example 11: statistics
Code project article: SharpPcap: Statistics
Does anyone know why?
You just found a bug!
WinPcapDevice was creating a new SendPacketArrivalEvent() instead of overriding it. Modified PcapDevice.SendPacketArrivalEvent() to be a virtual and WinPcapDevice.SendPacketArrivalEvent() to be an override and now the correct method is called.
The issue was that because WinPcapDevice was creating a new method instead of overriding it that PcapDevice was capturing a packet and calling its own SendPacketArrivalEvent(). This implementation doesn't handle statistics events as they are specific to WinPcapDevices.
Fixed the issue, updated the assembly info to 4.0.1 and uploaded the assembly to filedropper:
http://www.filedropper.com/sharppcap
If you could try that and see that it works I'll check the fix into git and it will go out with the next release of SharpPcap.
Thanks again for the bug report.
Chris
Author of SharpPcap

How to perform own assertions with coded UI testing

I'm working with the visual studio 2010 codedUI tests.
I want to be able to perform a little more than i can at the moment.
e.g. I can can Assert if a particular field "AreEqual" to or "Contains" etc, but i want to do more.
eg, i want to check if the field contains a numerical value within it.
I edited the UIMap.Designer.cs and was able to achieve what i wanted.
The only problem is is that this file gets overwritten when new test are added.
so my question is how can i "fiddle" with fields/stings in the UI and implement my own assertions on them?
Thanks
Use the partial class created (UIMap.cs) to add your custom code. This file doesn't get blown away and has full access to the internals of the UIMap (since it's part of it).
You can get it done dude, but be careful by keeping back up.
Open uitest file :
Go to test marker node that contains the relevant assertion,
Delete the method.
Save and find the stuff you expect
Its beeen working great for me but one two occasions I was dumbfound to face many issues with my acriipt running. So have back up and test this out.
I was told that the solution in "Coded UI" was to create your own libraries and then twitch your new test cases accordingly.
Haven't tried it, though.

Categories

Resources