Printing from Windows Store Apps with out using charms - c#

I am trying to Print receipt from windows store apps without Charms, but I am unable to do that.
Can you please suggest me how to print by single button click from App (without using charms)?

One possibility is to dump out a file (PDF?) outside the app's sandboxed environment (file picker). Then have a custom app/process "pick up" the file and send to printer. Which would be outside the app store.
In my OB1 Kenobi voice - "Use the Charms amanjaneyulu".

Related

UWP app start automatically at startup

All is in the title, I currently searching a way to launch my UWP app automatically at Windows startup with the UWP framework only, no file manipulation on the machine. The application must be able to be shared on the Store AND open when Windows starts.
Is it a feasible thing? If so how?
Thank you!
#hsmiths wrote easist solution to start app automatically and I'd like to summarize in step by step.
Open File Explorer
In address bar, copy-and-paste shell:AppsFolder
Right-click the app and then click Create Shorcut.
The message box asks to create shorcut on the Desktop. Click Yes.
In File Explorer address bar, copy-and-paste shell:startup
Go to Desktop and copy-and-paste shorcut to File Explorer.
Reboot your computer if you want to test.
+Tip: if you want to by-pass login dialog on Windows startup.
Start > Run
type control userpasswords2
User Accounts window will be opened. Uncheck Users must enter a user name ...
When you click OK, you will be asked to enter account password. Type password.
Reboot your computer if you want to test.
It seems that MS will add this feature - windows.startupTask - not only for converted desktop apps, but also UWP apps.
You can see it from about 37:00
Tip, tricks, and secrets: Building a great UWP app for PC
But this feature is not ready yet - It'll be available with Windows 10 Fall Creators Update.(I've tried with SDK 16225 but not ready yet)
Added 12/18/2017 - You can do it with Win10 Fall Creators Update.Following post show the details.
Configure your app to start at log-in (Windows Blog)
One consideration point is: By the feature, you can just 'start' the app - the app window is not shown. To see the app window, the user should click the app task at the task bar. It's a slightly ridiculous implementation for me. From the view of customer, 'click to start' and 'click to activate' is same behavior. You can do the some task in background before the user activate the app, but this is an another story.
If it's a desktop application converted to UWP you can declare a startup task in your appmanifest like this:
<desktop:Extension Category="windows.startupTask" Executable="bin\MyStartupTask.exe"
EntryPoint="Windows.FullTrustApplication">
<desktop:StartupTask TaskId="MyStartupTask" Enabled="true" DisplayName="My App Service" />
</desktop:Extension>
See Converted desktop app extensions
You can on Windows 10 (I'm not sure about Windows 8 or earlier versions), here's the instructions from Microsoft:
https://learn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-a-background-task
Even in Windows 10 IoT you can set an app to autostart through a PS command:
[192.168.0.243]: PS C:\> iotstartup list MyBackgroundApp
You can create a .bat script that execute "start AppID!App"
"AppID!App" string is available in shell:AppsFolder view, you have to add the given column.
Then place the .bat file in the startup folder:
"shell:startup" for the given user,
"c:\windows\system32\GroupPolicy\User\Scripts\Logon" for all the users of the given computer
I think that is not possible, but maybe you can use a trigger in order to activating a background task when something happen..
Here's a list of the available triggers:
SystemTrigger
MaintenanceTrigger
TimeTrigger
PushNotificationTrigger
NetworkOperatorNotificationTrigger
NetworkOperatorHotspotAuthenticationTrigger
However you have some constraint.. take a look here: http://blogs.msdn.com/b/windowsappdev/archive/2012/05/24/being-productive-in-the-background-background-tasks.aspx

UWP Modal Window

I want to show a modal window on the screen in my Universal Windows Platform app (C#), just like the standard Mail-app does when you add an account. Or when you're signing in to a service (like facebook) in an app.
Windows mail app with modal window:
You can move this window around, but it's not in the taskbar and it is modal.
Does anyone know how to do this? It shouldn't be so hard but i can't find anything about it.
As #Daniel Meixner said, adding account interaction of this Mail app is calling another app possible with LaunchForResults.
Using Task Manager of system, you can see that, when you launch this Mail app, it starts a process with the app's name "Mail", and when you add an account from this app, it starts another process with the app's name "Email and accounts".
If we use the Process Explorer to check on these processes, the Mail app's process is this:
and the add account process is this:
They are in different processes and have different package names.
So I created two apps and use LaunchForResult for communication between these apps, they act just like the Mail app of system.
If you just want to launch the system's "add account" app, you can refer to the official UserDataAccountManager sample.
In the mail app what's happening might be app to app communication with "LaunchForResults" - I'm not sure, but it looks like that.
With Windows 10 Universal Apps you can make one app call another app with LaunchForResults. The called app will always behave like a modal dialog to the calling app.
You can pass any serializable objects in both directions using ValueSets.
Details for LaunchForResult can be found here:
https://msdn.microsoft.com/en-us/library/windows/apps/mt269386.aspx
It is possible to create a movable window, but you can't make it modal.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f1328991-b5e5-48e1-b4ff-536a0013ef9f/is-it-possible-to-open-a-new-window-in-uwp-apps?forum=wpdevelop

Opening another WinRT app from another running app in FULL mode

I have 2 apps. I am running one in full mode and want to click a button from the first app to launch the second app .
My problem is that my second app is getting launched but both apps are in Snapped mode.
I programatically want to allow the other app to open in fill mode and first app should be in the memory.
Any help ?
Windows Store apps don't have any way to directly launch other apps. I assume you're launching a URI or file and your app is registered as the default handler (users can choose something else).
In your call to Launcher.LaunchUriAsync you can set the DesiredRemainingView in your LauncherOptions to indicate how much of the screen you'd like your app to keep. This is non-binding, but likely to be followed for UseNone. If there's room for UseHald (the default) then UseLess to snap/fill will likely be respected as well.

Windows 8.1 print directly to printer

I am developing a Windows 8.1 native app and the functionallity I am implementing requires a direct print to the printer, avoiding the default print flyout of metro apps.
However, I don't see the way to achieve it. I only want to tap a button and print a document directly, it must be a simple and quick operation for the user.
This is not supported from a general purpose Windows Store app. The Windows Runtime print API allows the app to provide the data to print, but the user is in control of the actual printing and which printer it goes to.
If your app is side-loaded rather than deployed through the store then it can use a Brokered Windows Runtime Component (BWRC) to call the desktop printing API to print without user input.
BWRC docs: https://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx

How to browse the content of File in window phone 7?

I am new to the windows phone 7 development world. I am developing an application in window phone 7. In window mobile application (smart device application) we can browse the content of the mobile device by selecting the tools -> Device Emulator Manager -> slecting the emulator & then after clicking the cradle we can browse the content of the mobile device. I want to know how to do this in windows phone 7 application ? I also want to know how to programatically access the content of the Window Phone 7 ? (for e.g I want to open the screen which we will be opened after clicking the upload button in asp.net. In that screen we can navigate between the folder structure of the computer. In such way I want to open the screen for window phone 7) Because I am developing an application in which I want the images from the existing mobile device. So I want to browse the content of the mobile device so that I can select the particular image from the existing content of the mobile device & after that I will dynamically add these images to the images folder of my application. Can you please provide me any code or link through which I can resolve the above issue? If anyone know anything that will also help me a lot. Please share anything whatever anyone knows.
Due to the security model of Windows Phone 7 and fact that applications are sandboxed means that it is not possible to create a file system browser on the device. You can only see files / the directory structure within IsolatedStorage and you must create these files yourself.
You can, however, use MediaLibrary.Pictures or the PhotoChooserTask to access the images stored on the device. These are the images youu'll see in the Pictures hub and, therefore are outside of the files you specifically put in IsolatedStorage.
You can only access the files/directories that are located in the Isolated Storage that is assigned to your application, and you can get a list of those via GetDirectoryNames (for folders) and GetFileNames (for files). You will have to implement a custom listing mechanism since there is no default storage browser component.

Categories

Resources