Handle Screen Off/On Event - c#

I am searching for an event with that I get weather the screen is turned on or off. In Android there is this nice BroadcastReceiver. Is there anything like that in UWP-Apps?
Kind regards

No, its the system level behavior and there is no bridge like BroadcastReceiver to deliver such message into the app. There used to be one for Windows Phone Silverlight but not available on Windows Universal App.
If you simply wants to keep the screen on, try this: RequestActive | requestActive method

Related

Put the calculator on TopMost C# [duplicate]

I'm developing a Windows 10 Universal app (UWP).
Is it possible to set application as TopMost (always on top)? Like WPF or Winforms (TopMost property).
Thanks
A feature called CompactOverlay mode was added in the Creators Update that supports this type of functionality. When an app window enters compact overlay mode it’ll be shown above other windows so it won’t get blocked. This allows users to continue to keep an eye on your app's content even when they are working with something else. The canonical example of an app taking advantage of this feature is a media player or a video chat app.
A blog post describing the feature can be found here
https://blogs.msdn.microsoft.com/universal-windows-app-model/2017/02/11/compactoverlay-mode-aka-picture-in-picture/
Short answer is no, there is no way as of today to make the application modal.
There is a petition going around asking for this functionality, which was requested last December but given the amount of votes it got (35 at the time this answer was written), it doesn't look like it will be taken into consideration anytime soon.
As mentioned in the comments, this functionality would be PC only so even if it was added, my assumption would be that it wouldn't work outside of the PC mode (so no tablet, mobile or surface family device support).
It's not possible UWP apps have some restrictions compared with WPF of Win32 apps(classic apps).
With uwp apps you need enable some capabilities to do something special in your app as you can see in the link uwp apps need ask for permission or they can't access or modify files directly.
https://msdn.microsoft.com/en-us/library/windows/apps/mt270968.aspx
Best Regards

C# Windows Universal 10 TopMost Window

I'm developing a Windows 10 Universal app (UWP).
Is it possible to set application as TopMost (always on top)? Like WPF or Winforms (TopMost property).
Thanks
A feature called CompactOverlay mode was added in the Creators Update that supports this type of functionality. When an app window enters compact overlay mode it’ll be shown above other windows so it won’t get blocked. This allows users to continue to keep an eye on your app's content even when they are working with something else. The canonical example of an app taking advantage of this feature is a media player or a video chat app.
A blog post describing the feature can be found here
https://blogs.msdn.microsoft.com/universal-windows-app-model/2017/02/11/compactoverlay-mode-aka-picture-in-picture/
Short answer is no, there is no way as of today to make the application modal.
There is a petition going around asking for this functionality, which was requested last December but given the amount of votes it got (35 at the time this answer was written), it doesn't look like it will be taken into consideration anytime soon.
As mentioned in the comments, this functionality would be PC only so even if it was added, my assumption would be that it wouldn't work outside of the PC mode (so no tablet, mobile or surface family device support).
It's not possible UWP apps have some restrictions compared with WPF of Win32 apps(classic apps).
With uwp apps you need enable some capabilities to do something special in your app as you can see in the link uwp apps need ask for permission or they can't access or modify files directly.
https://msdn.microsoft.com/en-us/library/windows/apps/mt270968.aspx
Best Regards

Screensaver app on Windows Phone 8.1

I would like to create an app which would pop-up fullscreen when user is not interacting with the device; the first tap would then close it. So it's exactly like a screensaver. It should "run" 24/7. Display should always be lit. Battery is of no concern.
I've already done this on android, but my WP skills are lacking and complete research would take me at least a couple of days, so I'm asking any WP gurus out there:
can the same functionality (screensaver) be achieved on the Windows Phone 8.1 platform?
If so, which are the basics that should be covered (programming-wise)?
Edit:
The only solution I have at this moment is changing the LockScreen background on a 30minute interval.
I'm still not sure whate happens in 2 weeks as some info suggests that the registered task will expire. Not to mention that LockScreen is shown only a few seconds.
Edit 2:
Subquestion: is there a way to keep LockScreen shown at all times (while charging)? Or maybe lauch lock screen from code?
Windows Phone doesn't usually allow apps to pop up on their own. Exceptions are made for specific usecases such as voip. There is also no way for an app that isn't running in the foreground to realise that the user hasn't interacted with the screen for any number of minutes.
Therefore your only option is to use the inbuilt lockscreen functionality.

Full screen WPF App To act as operating system

I realize this might sound a little dubious but I assure you it isn't. I have a client who wants a win 8 pro touch screen app. One of the requirements is that the app is the only thing on the device the user may use. So my question is, can I make it so that the user cannot exit my wpf application? I have it running full screen without toolbars but they could still click on start etc. I essentially want it to run on windows but kind of be its own OS. Any advice is appreciated. Also if this is something that can be handled in group policies or some other way I would love to have that advice as well. Thank you.
You'll need to set Windows 8.1 to run in "Kiosk" mode.
How to enable Kiosk mode in Windows 8.1
The only caveat, is that the app must be a Windows modern app, not WPF.
Windows 8.1 comes with an excellent feature where you can lockdown the
device allowing the user to use only one application. You need to keep
in mind that this application needs to be a modern application and
cannot be a desktop application. So, if you are going to use it for
your customized company application (For e.g. ATMs, Flight Schedule),
the application should be a modern application
There is a product called "Secure Lockdown" from Inteset http://shop.inteset.com/lock-down-windows-7-with-inteset-secure-lockdown that looks like it can be used with a WPF app. I've not used it (yet), but it looks like it should work for your scenario. It's not free, but it reasonably priced at around $20. It says it is compatible with Windows 8 as well.

How to keep you Windows Phone 7.5 application on top

we are creating a windows Phone 7.5 application, this application is developed for specific purpose for company field employes, phones will contain the data sim. No communication allowed like making a phone call, sending sms or chekcing and repling email etc. This application will receive the Push Notifications from our application in the head office.
Is there any way that we can keep this application always on top, regardless what button is pressed by the user we want this application to always stay on top so what ever the notification it receive it will always disply it to the user for futher action.
Thanks
This requirement is not really feasible for a couple of reasons. First, what you are describing actually breaks most of the concepts that a certified app is required to follow. A subset of certification details can be found here: http://msdn.microsoft.com/en-us/library/hh184840(v=vs.92).aspx
Secondly, even if you planned to override the back button (possible) there really is no way to override the Windows, search or camera button at the OS level.
Best of luck!
Short answer: you can't. Application switching is part of the OS, and you don't have control over it.
Best workaround is to pin the app to start and allow it to do background processing with updates to the live tile.
If it's an absolute requirement, you'll have to jailbreak the phone and install your own OS on it.

Categories