Windows Phone 8 show MessageBox when app closing (deactivated) - c#

I am trying to show user MessageBox just before app is closed (or deactivated). So I added this to both events:
if (AppSettings.ShouldShowAlertTransfer)
{
MessageBox.Show("...");
}
But the MessageBox is not shown. I am adding this because then I am adding background transfers and I must inform user that I created some background trasnfers. I know I can add this code to OnKeyBackPressed in every page. But it's working just for back key and not middle button. And it wouldn't be nice to have same code copied in every page.
So is it possible to show this MessageBox in App.xaml.cs? How can I do that? If it's not how can I show MessageBox when user pressed middle button?

I was intrigued by your question so I opened up a solution and attempted every single override available and every single page event. I also tried all of the methods in the App.xaml.cs.
I can unequivocally say, based on the MSDN documentation and my own personal testing that there is no way to detect the home button press or search button press. Furthermore there is no way to display a message box to temporarily stop one of these actions.
This testing was done on Windows Phone 8 with the WVGA 512MB Emulator in Visual Studio 2013 Ultimate.

Related

Unity. Closing the android phone screen during the ad display process causes a black screen to appear

I'm trying to implement unity ads for the first time in an android game. Everything seems to be working properly except for one thing. When the ShowAd method is called
it takes 2 seconds for the advertisement to be actually displayed, during which time if you turn off and open the phone screen, the game stops, superimposing a black screen on the screen. I think what really happens is that the ad starts in the background until the application loses its focus, and when I reopen the phone the ad closes automatically leaving only the black screen. I thought that to avoid this, I should reload the application based on a check in onapplicationfocus function, such as: if the user pressed the lock button on the phone, if the screen is closed, or simply a check if the application is lost focus due to the ad or another event. Another solution would be to configure the application to run in the background somehow, but I did not manage to apply any of the above. Does anyone know how to apply one of the above? Thanks in advance!

how to disable Keyboard inputs on windows like (temporary)

i have problem i'm trying to do new shortcut but if i put the shortcut i made F11 then will happen is full screen , i want to disable Keyboard inputs form windows or just disable the actions form windows i mean (if i press any key i want to put the action not windows put the action)
i create application that raises the volume , i put the volume up "F11" but in google chrome F11 is full screen, there anther application if i press F11 or F10 or F9 it do something and i dont want this happen.
i'm using Visual Studio Windows forms C#
note: my application work in background (i dont want use From1_KeyUp or Down i know this code)
Thank You for help
enter image description here
2 pictures
enter image description here
To prevent keys from reaching the target application you must use a low-level keyboard hook and return a non-zero value when you performed your own custom action.

UI Automation monitoring

I'm trying to monitor an external WPF application(no source-code) from a local app, and see when a button is clicked in c#.
So far i've been exploring UI Automation's options, and i saw that it works similar if not same to the Inspect.exe tool.
The problem i have is, the WPF form i need to monitor does not contain the button i need directly, as a sub-control. Instead, first you need to log in, then click a few buttons and then finally a new window opens, and it contains the button i need to check.
So my question is, is there a way this to be monitored with the UI Automation? I know i can trigger an event when the main form starts a new process, and the button is clicked, but how do i handle all the steps in between?
(Or in other words how can i trigger an event when the final window containing the button i need to check is actually open)

Send window to back when activated

I found the answer to this question in here.
that solution works great when you call the method just once (don't call it from the event window activated). I am creating a gadget and I want the window to always be in the back. if the user clicks on the gadget I don't want it to come to the front which is the default behavior of windows. so what I did in order to solve that problem was to create this event:
private void Window_Activated(object sender, EventArgs e)
{
SendWpfWindowBack(this);
}
so every time the window is activate it call the method founded on the first link that I provided. the problem is that the system tray gets sent to the back. let me show you what I mean.
that is my gadget on visual studio.
when I run it it get's sent to the back: (I open notepad and outlook to illustrate my point)
now when I click on it the event window_Activated fires and it gets send to the back:
But note how the system tray (windows start up menu window) get's sent to the back!!!!
it still is behind everything exept the most important window wich is the windows start up menu. How can I resolve this. why is it going in front of the system tray !?
After 2 hours of stubbornness I figured it out... Since the window was so big for some reason that happen (gadget was bigger than entire desktop). I made it smaller and it worked.

Reset Taskbar Flash in C#

I have an application where the taskbar flashes if an event has occurred. This is working perfectly, and was relatively easy to implement using a Win32 API described below:
http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx
However, when I stop the flashing, sometimes the application is stuck in the "highlighted" state in the taskbar. This only gets reset by clicking on the application in the taskbar, minimizing it, then re-maximizing it. Is there a way to clear this from being highlighted without any user interaction?
Maybe instead of flashing it you could put an overlay icon on it - one line of code from C# with the Code Pack. Then when you want to clear it you could take the overlay icon away - again one line of code. Windows 7 only, however.
Can you post the code that you are using to "Stop" the flashing?
Have you also considered using a different flag such as:
// flash until the window comes to the foreground
FLASHW_TIMERNOFG = 12;
You will still need to click on the applicaiton to get the flash to stop, but you should not have to minimize then re-maximize the app to get the flash to stop.
You can include the FlashTaskbar snippet and use the following code
FlashWindow(Form.Handle, FlashMode.FLASHW_STOP)

Categories