UWP How to hide the app? - c#

In my application their is one option to hide the app. Whenever user clicks on hide the app window as well as the app icon from task bar should be get hidden.
How to achieve this in UWP?

This feature is not supported (yet) on UWP.
If you look at the UWP Skype, it always remain visible from the taskbar along with all the other apps. A UWP app cannot register by itself a global shortcut to be launched.
Minimized UWP applications are suspended by the OS when it wants/needs and will not be able to perform any job. If you hide your application you will be suspended and will not be able to perform any work. The only exception being if you request an extended execution time, your application will be allowed to run while minimized. They will still be limits but they are more battery/lock screen bounds.
If you really want to hide your app, you should just close your app window and rely on some background tasks to perform the work you might want to do when hidden/stopped.
This should be a good reading:
Windows 10 universal Windows platform (UWP) app lifecycle
Support your app with background tasks
Postpone app suspension with extended execution

Related

How i can maximize UWP after launch?

I'm launch my app when the user logs in to Windows. I have the appropriate Extension (StartupTask class) set in Package.appxmanifest, and I can get the app to launch when I log in to Windows, as expected. However, the app minimize after start. How i can his maximize after start?
I tried the ways from this thread
the documentation explains this:
UWP apps must call RequestEnableAsync from a UI thread to trigger a user-consent dialog. If the user consents, the UWP app will then start on startup or user log in. Note that UWP startup apps will start minimized.
Minimizing when starting the application is the default behavior. This is to ensure a good user experience for Store app by default. Currently, UWP does not provide related APIs to modify this behavior.

How to know the app suspension reason in WinRT app?

In my Universal app, (Windows 8.1 Windows Phone8.1), I want to know the reason why my app is suspended like due to a launch of a launcher(Mail, File picker etc) or user pressed the Windows button. Is there a way to determine this?
Unfortunately you can't know what caused the app's suspension. Unlike the LaunchActivatedEventArgs in the OnLaunched method for example, that contain the Kind property the SuspendingEventArgs in the OnSuspending method don't provide any such information.
However, there are only so many reasons that an app can be suspended. Like you said (in windows phone only) it can be suspended due to a launch of a launcher or a protocol and by the windows button.
The windows button is the only suspension way of which you have no control. For all the others you can trick the system and for example set a static global variable that you update when you launch an operation that would suspend your app and check it in OnSuspending

App doesn't close, always remains in Suspended mode while usage of background task in c#/xaml windows store app

I am developing an app. Which uses live tiles with background task (as WinRT Component) as I want to updates tile with time trigger. I have noticed that if I set permission of lock screen to ON and let the background task run then app always remains in suspended mode after I close the app. So how can I kill the app and let the background task run on it's own ? I am following this sample.
You can forcefully close an app in a number of ways:
Alt+F4
Swipe the app from the top of the screen to the bottom
Use the task manager
You cannot programmatically kill your app (well you can if you introduce a NullPointerException (DON'T DO THAT) or if system memory requirement kicks in (system needs memory for other tasks so OS will kill your application.).
please read following article on Windows 8 application lifecycle.
Application Lifecycle

How to disable Suspending || Closing || Terminating event for my Metro Style App on Windows 8 Pro

I'm a french developer and I need to develop an Metro Style app for Windows 8 Pro who is always launched. I wanted to know how can I disable the close event of my app. My app need to be in front all the time and the user couldn't quit the app.
I thought I could disable all the shortcut with the GPO but the close gesture (drag the app from the top to the bottom) need to me disabled too.
I hope I was clear and everybody will understand the question :-). Feel free to ask me more specific questions.
Cordially Renaud.
The short answer is: You can't.
The operating system and the user control the lifetime of Metro Style apps, you can't block the user from switching away from your app and once your app is no longer in the foreground, the application is suspended and the system can terminate the application at any moment.
Similarly, the user close gesture cannot be blocked.
In Windows 8.1 you may find Kiosk Mode to be what you need.

Smoother Transition between application in windows app, c#

My application handles the startup and termination of external some application.
An inbuilt TaskBar is there to tab the applications that are started.
Say when three applications are started, i map those 3 applications to the tabs created. So that the user can use the task bar to switch between the application. The default windows task bar will be replaced by my applications taskbar because it is a Kiosk application.
All these works fine...
What i want to do is, the toggling between the applications is not smooth, which the user dosent like.
I want to make the change of applications smooth. I am using windows XP.
I am calling ShowWindowsAsync function to show the application when user clicks the respective tab.
How can i make the the visual effective using c# ? Is there any possibility ?
P/Invoke AnimateWindow() to get transitions. Visit pinvoke.net for the required declarations.

Categories