Update UI when application runs in backroud - c#

I am developing a banking application for Windows Phone 8.1 RT. For security reason I need to grey out or show an image in my application when it goes background.
It's like when application is running user presses windows button then press and hold back button at that time application's current page is visible. I need to show a image on that view.
When application is running if user press and hold back button at that time also irrespective of page I need to grey my application or show an image.
I have tried changing the opacity of frame in On suspending event it is not reflecting. I have also tried in Window visibility changed event changing the opacity of Window.Content but it's not working too.
Please help me with some pointers on how to achieve this.

There isn't a good way to do this. The app doesn't suspend until several seconds after it has left the screen, so it is too late for the app to change its UI then. Window.Activated would be closer, but is still too late.
ApplicationView.IsScreenCaptureEnabled will prevent capturing a screenshot of the page either in the app or on the task switcher page, but won't prevent the image from showing at all.
The least bad may be to call Application.Current.Exit to close the application completely when deactivated. This is generally a user unfriendly idea, but it will remove the app from the task switcher one it closes (it will probably show up briefly first though).
You can post feature requests on http://wpdev.uservoice.com

Related

Cycle through open windows in C# using ALT+TAB/ESC and have the current window in focus and forced to be maximized (if already minimized to taskbar)?

I am writing a small application to automatically rotate through open windows on Windows 7/8.1/10 PC's. I have written the majority of the code and it is working well except I cannot figure out or find out what key presses to use to cycle through open applications.
I have tried SendKeys.Send("%{Tab 2}"); but this seems to only actually press the TAB button once as it keeps switching between the same two windows (even though more are open).
I have tried SendKeys.Send("%+{Esc}"); but this doesn't maximize windows that are minimized to the taskbar. It will effectively cycle through each open windows and bring them into focus (as evident by watching the white semi-transparent overlay on the taskbar item) but it won't show them on screen - I'm assuming because they started minimized. Only the maximized ones will show on screen when it's their turn.
Can anyone please assist? I'm sure it's a simple fix of maximizing the window it cycles to but I'm unsure how to implement this.
I haven't included the code of the entire application as I don't think it is relevant. If you do require it please let me know and I will add it.
Many thanks.

WP8 - How to disable the app Splash Screen for certain pages?

I have an app that uses a Splash Screen when it opens up, and it works fine.
The problem is that I've added a couple of pages that can be accessed via two live tiles, and the point is to let the user istantly load a certain section of the app without having to load the whole MainPage.xaml page, which is quite heavy to load.
These two pages are really simple and load almost istantly, but the app loads the Splash Screen anyways, and I don't like that.
Is there a way to "disable" the splash screen for a specific page?
Via C# or directly from the XAML, I don't know.
I enabled the Splash Screens simply by adding the SplashScreenImage.screen-WXGA.jpg (720p and 1080p as well) to the project main directory.
Thanks! :)
Sergio
No. You can't disable the splash screen. What you can do is to minimize all initialization work your app has to do so that the splash screen is shown for a minimum of time.
Sergio,
You can simulate a splash screen and decide based on how you were activated to show it or not. This sample shows one way to do it: https://code.msdn.microsoft.com/windowsapps/Splash-screen-sample-89c1dc78/
I would show it for the main xaml and others that take a long time to load and dismiss it in code.

Can I use the splashScreenImage to all my app pages?

I'm writing an application for wp7 with several pages, and i want to the splash screen image at the load of every page i have in the app - so the user would figure out he needs to wait a few seconds.
The default splash screen image is fine for me, but i don't know how to do it.
thanks for any help!
You can customize your own splashscreen dont need to use the default
Use the Loading method for the page which should be located on a panel on the left side of Visual Studio's Screen
You can do this by loading the SplashScreen Image on load of every page for some predefined time. And meanwhile other tasks can be done on Background threads (if they are not related to UI).
Also if you want to show a loader to User, you can create a Grid with some Background (semi transparent) and a Progress Bar on it. You can set its Visisbility true before any process which will take time and then hide it after process ends and Application is ready for user..

form not getting proper focus in c#

i have written a small form application, which contains textbox only. I have enabled shortcut key by using low level keyboard hook to give focus to application when needed.
All is working fine, I press the short key i.e. (Left Control Key)+(Left Control Key) for the first time the application get proper control (focus).
But when I deactivate and redo the shortcut key, the icon of the application on the taskbar starts blinking and the form doesn't get focus, the title bar is greyed out.
More Information :
on deactivation the form's opacity is reduced but it remains on top, so the whole time the form is displayed on the screen
This form is activated from another class, within the application.
On Activation event opacity of the form is increased so it now very well visible
I am giving focus to the application by using form.Activate() I have also tried from.Visible but with no luck.
The activation works for the first time only, post that the icon in taskbar blinks.
Does any have any idea why is this happening?
This answer applies to you as well:
https://stackoverflow.com/a/3789985/64121 . You need to make use of the AttachThreadInput API function in order to steal focus away from another app.

Setting focus on control causes windows tool bar to appear

When I set focus on a text box, on a forms load event in Windows Mobile 5.0, the Windows tool bar appears even though my form is maximized.
When I do not set the focus on the text box the form opens maximized. I do not want the windows tool bar appearing.
How do I prevent this from happening?
TThe start bar in WinMo is actually not part of your app - it is a separate process managed by the Shell and it really wants to always be on top. Trying to get your app above it goes against the design goals of WinMo (though it's a common thing to want to do).
I'd recommend doing some searching and reading on "kiosk mode" to garner what knowledge you can from others who have been down this road, but what you're seeing is that the StartBar is getting set topmost.
Raffaelle Limosani has a pretty decent blog entry that covers kiosk mode, so it's a good place to start (take a look at the other blogs he links to as well).
The toolbar at the top is actually a separate window, and it has a habit of appearing when not wanted over top of a full-screen ("kiosk" mode) app. For example, if you ShowDialog a second full-screen window from the first, the Start window flickers up for a split second before going away.
The only way I ever found of dealing with it was to hack into the API and actually make the Start window hidden while my application was open. This is a big potential problem, because if your app crashes without making the Start window visible again, it will stay invisible until you reset the device (or run you app again successfully).
I'd advice against doing this unless you absolutely have to. As ctacke points out, this would be an example of an app not playing nicely with Windows Mobile.

Categories

Resources