Launch printer from the app - c#

I am working on a UWP project and I am trying to print an image from my app. I have tried using the printing sample from microsoft but it's utterly confusing and it's stuck on an error I don't have the time or the patience to solve. Is there a way to launch printer programmatically as if I right clicked the item and chose print?

Diederik Krols did a very detailed blog post about printing, it's for WinRT but should mostly work for UWP too ( except for margins and layout because that has changed in Win10 UWP )
So take a look at this sample http://blogs.u2u.be/diederik/post/2013/01/20/Printing-from-MVVM-XAML-Windows-8-Store-apps.aspx
It's still a lot of work though...

You shoud use RawPrinterHelper class Please see the example in the following link
https://support.microsoft.com/en-us/kb/322091

Related

How can i implement Twain in a UWP App for scanning documents

Im trying to create an UWP App that allows the users to scan documents with TWAIN. I tried a few nugets such as Atalasoft DotTwain, NTwain, TwainDotNet and Saraff.Twain. All of them have samples made in WPF, Winforms... except the Saraff.Twain nuget that have a sample made in UWP.
The problem here is that when I run the WPF and Winforms samples all of them works pretty nice, basically is what I need to do but in UWP and when I try to use the code of the samples on my own App it doesn't build because it doesn't recognize a lot of classes even with the Using sentences at the start of my class.
The Saraff.Twain UWP sample doesn't build and i can't find another Twain UWP Sample on google.
Im not putting code because there is no particular problem but if you want it just leave a comment and I'll upload some.
Does anyone have used TWAIN in an UWP APP successfully? I'm very lost with it... Hope any of you have the key to the gate. Thanks.
UWP has its own document scanner API. In addition, it is possible to use Dynamic Web TWAIN in a UWP app. Check this blog: https://www.dynamsoft.com/codepool/uwp-document-scanning-web-twain.html

Xamarin Forms Android - EnableForegroundDispatch

I am trying to adapt a version of this demo app on Github for my own usage: https://github.com/xamarin/monodroid-samples/tree/master/NfcSample
The problem is that on an NDEF formatted tag the app can write to tags consecutively but when a format is required the write only works once. If my phone is locked and then unlocked with the app running and it comes to the foreground it works once again. I think it is something to do with 'EnableForegroundDispatch' but I am not sure.
Any help appreciated.
Thanks
Paul.

How to take a photo without preview. Android. Xamarin. C#

I have a sample code from xamarin.com:
How to click the Button and take a photo without preview?
Maybe you have an articles, or videos. I'm new at Xamarin, so it will be awesome, if i'll get as more details as possible.
This article will get you started with a stream of the camera to a surface in your app. It shows you how to get to the Camera class, which in turn has a TakePicture method that you could use for your problem.
Please also take a look at this answer on SO on a similar question (native Android, but the same concepts apply), which suggest showing the preview on a 1x1 surface because you can't really prevent the preview on Android as far as I know.
PS: don't forget to add the correct permissions in your manifest for Camera access.

How to make a start tile reference the desktop AND modern mode of an app?

I've made an app for the Windows desktop and also created it for the modern (metro) interface in Windows 8.1. I wanted to group them under the same start tile and have a setting that allowed the user to open the app in the chosen mode by clicking the start tile. I got this idea from Chrome, which has both modes referenced by the same tile in the start menu or the link on the taskbar. I thought that maybe when the setting was changed I would delete the current one and replace it with one that referenced the other mode, but positioning is a problem, as a new tile always appears at the far right of the start screen. How would I resize the tile correctly and how would I delete and replace a link on the taskbar? I am using VB right now, but I can write C# and C++ so feel free to post code or links to code that are written in these languages.
If you have any suggestions, please post a reply or a ask a question in the comments.
I also should note that I prefer to use native libraries only and do not like using third-party dlls.
Thanks in advance for the help.
P.S. I've already tried Google.
I've figured it out!
The best way to do this is to create two registry keys referencing the two interfaces but make both the desktop and modern version not have a start tile! Then create a third app that has a tile and make it open the files, check for the active interface, and send the data to that interface with the file as a param.
Thanks for everyone's help, though :)

Is there an easy way to detect shake motions on Windows Phone 8?

I need to detect a shake movement on a Windows Phone 8 device, in order to launch a specific action. How can I do that ?
I found several mentions of a "ShakeGesture.dll" library made by Microsoft for WinPhone7, but the only place where it was available (AppHub) was replaced by the Dev Center website...
Thanks for your help!
That's odd. Looks like the AppHub to DevCenter rename broke the download links.
I've uploaded the library to my domain in the meanwhile until those links get fixed # http://JustinAngel.net/Storage/ShakeGestures.zip
Here's an example on how to use the Shake Gesture Library:
http://blogs.microsoft.co.il/blogs/arik/archive/2011/04/01/shake-gestures-library-a-windows-phone-recipe.aspx
You should be able to add a reference to the ShakeGestures.dll assembly to get started. If you're using the Windows Phone 8 SDK, I believe this library is included - you'll just need to add the reference.
UPDATE:
You should be able to download it with this link:
http://go.microsoft.com/fwlink/?LinkId=219094
I found that here. If you scroll down to "Locations and Sensors" about 2/3 of the way down, there's a link to download the gesture library as well as an example.
UPDATE 2:
Hmm. It appears that download link was the sample project. The ShakeGestures.dll doesn't seem to be in it either. I don't have VS2012 on my computer here at work, but if you do, you could open up the sample solution and see if it is referencing that DLL somehow, and maybe see where it points? It seems like it has to be using it...I just can't open it in VS2010.
Download ShakeGestureLibraryCS from Windows Phone Developer Samples:
http://code.msdn.microsoft.com/wpapps/Shake-Gesture-Library-04c82d5f
Download C# project and Build (for Release) to create the 'ShakeGestures.dll'
Add Reference to your WindowsPhone project.

Categories