How i can maximize UWP after launch? - c#

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.

Related

How to launch in system tray icons a MVC app

I'm developing a MVC application using .NET 6.0. I am publishing the app with the following configuration:
The app, so far, is launched by double-clicking the .exe, it shows the classic "cmd-style" window.
Now the requirement is to start the portable app minimized into a system tray notification area in Windows (if this is not possible, I was looking for a method to deploy the app as a service which runs in background).
How can I achieve this? Thank you.
To obtain access to the system tray, you need a message pump and a target window. In other words, a regular command-line executable doesn't cut it. Basically you need to have an executable that creates a window (can be an invisible one) and then the main thread must pump Windows messages.
I'll say this much for now becuase the provided information is insufficient and explaining all possible scenarios would be too long a response.

How do I show status to users from my UWP app?

We are creating an application(must be UWP for Microsoft app store). The application will remain running and we want to “hide” the UI from the desktop after they log in (not in taskbar). We want to put it somewhere where they can see the status of the application and/or logout (like a VPN or Anti-virus app shows status).
We have investigated using systray (non existent in uwp), quick actions tray (seems to be for system applications), notifications (show status there, but user can remove it—looking for something like the Action Center buttons for Wifi). Our goal is to have an application running, but out of the way, with access to the status and logout functionality. What is the Microsoft approved way? If there is no such approved way, how have you solved this?
At this point, that's not supported in UWP.
You can however publish WPF applications to the Microsoft Store using Desktop Bridge. I haven't touch it, but I've seen a few apps in the store running more elevated access than UWP and you may have the ability to control the visibility of the application's icon (ie taskbar/systemtray).
Give it a try and let us know if it works.
You're right, but there are some workarounds that can be used:
1. USING THE DISMISSED EVENT to show the notification again if user dismissed it.
2. UWP APP WITH SYSTRAY EXTENSION
As explained in this blogpost, you can add a component that will create the tray icon.

UWP How to hide the app?

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

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

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