UWP/XAML programmatically click a button with UI animation - c#

I try to make a NumPad similar to the one in the standard Win10 Calculator App.
I implemented a function where the user can press a number on the hardware Keyboard and it will press a button programmatically. To get the number is no problem but I also want to start an animation on the software NumPad like the one in the Win10 calculator.
How can I start that animation by code?
NumPadAnimation

How can I start that animation by code?
You could start the storyboard(the animation) by calling the the Begin method of the Storyboard.
Please read Storyboarded animations for more information.
By the way, the MS calculator is now open source. You could check its source code to learn what you want.

Related

C# Disable mouse takeover

I am currently using the windows on screen keyboard to control the program for the cnc machine. In C# I tried to make a simple on screen keyboard with only the keys I need. I use this command to send key
SendKeys.SendWait("{ENTER}");
or
SendKeys.Send("{ENTER}");
The first click works, but then the background program "takes away" the mouse after the click and then I can no longer control it. While such a problem does not occur on the windows on screen keyboard
Is there a way to avoid this, to make it work like microsoft osk?
Thanks

Send keystrokes to other applications

I'm trying to write a program in C# that lets me send a keystroke to another program that's open but is not in the foreground. The purpose of the program is to let me start recording gameplay footage from my Xbox 360 using TotalMedia Extreme while also starting recording in audacity to record from the PC mic. That way I can get both tracks to be synced instead of starting gameplay recording and quickly switching to audacity and clicking record.
Basically all I need this program to do is detect a mouse click while TotalMedia Extreme is in the foreground and when the mouse is clicked, send the hotkey command to Audacity to start recording. Does anyone have an idea for how I could get started with this?
This seems like it might be a good place to start, but I don't think it will do the same thing I need to do:
Send fast textinput to another process (Window)
Check this: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632589(v=vs.85).aspx
I suppose you could do it through Windows Hooks, in particular WH_KEYBOARD_LL
Just use AutoHotKey. The command SendMessage will send keystrokes to a non-active window, but you could also just have AHK activate the right window before sending keystrokes. Once you are done you can wrap it into a handy little hotkey or even compile it into an exe file.
AutoHotKey is definitely the rout I'd go. You can use a function called ControlSend to send keystrokes to specific controls of specific applications, even if they're in the background. Sounds like it would work perfectly for what you're needing. The forums over at AHKScript.org are really helpful too, so you might check them out as well!

Detect lock button press

I have been asked to make a morse code app using Windows Phone 7.
I need to be able to press the lock button multiple times to trigger my app to detect what sequence and timings have been pressed.
For example if I press the lock button on my phone (HTC Radar) five times I want my app (which would be running in the background) to detect that it has been pressed five times and at what timings so that I could figure out .- or "short / long" patterns then open itself up.
How would I go about this?
I have used XNA and C# for XBOX but not for mobile devices.
Thank you.
There is no API to solve your problem.
Your application can subscribe to the Obscured event. But this event does not mean that exactly lock button was pressed. It could be the SMS or phone call.
You can't do the background application wich will run all the time, and handle lockscreen button.

detect printscreen

simply put I want my program which runs in the background to check whether the print screen button has been pressed (which mostly triggers a function within another program to generate a screenshot of the current window. eg a game screen).
I have seen lots of possible answers, but most seem overkill for just detecting the print screen button.
I want to have a program in the background check so that it can move the screenshot that has just been made/saved to a certain location. after the button had been pressed.
I hope this question is clear, if not I'll try to explain more clearly.
ps
On a side note, would it be better to try and detect the printscreen button or to simply check the specified folder every 1 or 5 minutes whether a new image has been put in that folder and then move it if true.
EDIT
I decided to use the FileSystemWatch, however it seems to be to fast if i use the on create event as sometimes the file is still being made and it can't move the file yet.
Would the best action be to use a timer to delay ?
You could just watch the folder location for updates using a FileSystemWatcher. There are many examples around the place.
Global keyboard capture in C# application
You should be able to use a global key hook to handle the print screen key press.

How do I determine program interupt in Windows Mobile

I have an game application I have written for Windows Mobile and I want to have a timer associated with the puzzle. If the program loses focus for any reason (call comes in, user switches programs, user hits the Windows button) then I want a pop up dialog box to cover the puzzle and the timer to stop. When the user closes the pop up dialog the timer can start up again.
Does anyone know how to do this?
Thanks
Take a look at the article over at OpenNETCF's Community site on determining when a Form or Process changes.
A quick way would be to use PInvoke to call GetForegroundWindow() and GetWindowText() whenever your timer ticks (once a second?).
GetForegroundWindow() returns a windows handle which you can use to call GetWindowText(). If the text of the foreground window matches your form's Text property (its caption), you know your app has the focus. You can then show or hide your puzzle in each timer tick.

Categories