In addition to soft keys, I'd like to test how my app responds to the hardware shutter buttons (e.g. various states half-pressed, fully-pressed, button-release. etc...).
The emulator does not seem to have a hardware shutter button (unless I am missing something).
So, in the absence of an actual device, how can I test this functionality?
The F7-Key is mapped in the emulator to the camera shutter-key fully pressed and the F6-Key is mapped to the half-pressed shutter-key.
Both shortcuts are not supported in Visual Studio 2010 Express for Windows Phone (but I have no idea why they did this limitation...)
http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff754352%28v=vs.105%29.aspx gives a list of supported emulator hot-keys. :)
You could have specific buttons in your application and simply invoke the method wired to the event handler. For example:
// Constructor
public MainPage()
{
InitializeComponent();
CameraButtons.ShutterKeyHalfPressed +=new EventHandler(CameraButtons_ShutterKeyHalfPressed);
CameraButtons_ShutterKeyHalfPressed(this, new EventArgs());
}
void CameraButtons_ShutterKeyHalfPressed(object sender, EventArgs e)
{
Debug.WriteLine("HALF_PRESSED");
}
But that would only help if you are willing to have a dedicated "test panel" in your application that will control these events.
As with everything else hardware related, you kinda can't ;-) So hurry on the mailman to deliver your phone already!
Related
public MainPage()
{
this.InitializeComponent();
NavigationService.Navigate(new Uri("/SpillGuard.xaml", UriKind.Relative));
}
Error saying Navigation Service doesnt exists in the current context.
Like Romansz said, try searching a little bit harder next time.
NavigationService does not exist because it is only used in Windows Phone Silverlight apps. Use Frame.Navigate():
Frame.Navigate(typeof(YourPage), optionalParameter);
Could anyone tell me how to capture a long press for a windows store app in C#?
I can used a "tapped" gesture no problem but when I replace
TappedRoutedEventArgs with HoldingRoutedEvent it just doesn't register a holding gesture.
I'm testing this with my laptop so could it be that it doesn't recognize a mouse holding event?
I'm assuming there's similar functionality for the windows phone 7 but they're mostly for Silverlight which isn't used for Windows 8.
Any links/examples would be a great help!
Thanks!
Use the Holding Event:
XAML:
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Holding="Grid_Holding_1">
</Grid>
CS:
private void Grid_Holding_1(object sender, HoldingRoutedEventArgs e)
{
Debug.WriteLine("You held at" + DateTime.Now.ToString());
}
You are correct about the mouse not firing the holding event. Run it in the simulator and then you can use the "Basic Touch Mode" to simulate the hold.
While certifiying my Phonegap App for Windows Phone 7 I was told that the back-button doesn't work the way it should. My application only has one page, so here it's not a problem but it is possible to display a menu using javascript.
When this menu is open, the back-button is supposed to close the menu instead of exiting the application. Does anyone have an idea on how I could easily catch the event of a click on the back-button in order to check if the menu is open and then close it or completely exit the application if it isn't?
I tried document.addEventListener("backbutton", onBackKeyDown, false); but apparently this does not work for Windows Phone 7!
Thanks a lot
WP7 PhoneGap definitely supports the back button. You can download a working example from my blog here:
http://www.scottlogic.co.uk/blog/colin/2011/11/handling-the-back-stack-in-windows-phone-7-phonegap-applications/
Make sure you handle the deviceready event first.
Why don't you use the native Silverlight.
XMAL
BackKeyPress="PageBackKeyPress"
Code-Behind
private void PageBackKeyPress(object sender, CancelEventArgs e)
{
// DO NOT CLOSE
if (Something)
e.Cancel = true;
}
I have the same problem. When you write
document.addEventListener("backbutton", onBackKeyDown, false);
That will block the the default backbutton handler. So you may need to do so tricks in the phonegap code. It's not the best way, but it's quite easy though. Check out this one:
http://blog.projectdebug.com/?p=6
I want to offer a Pin to Start menu command when the user presses and holds on certain sections within my Windows Phone 7 app, as utilized within many other apps. How can this be done?
Unfortunately, this is not available in the current version of the operating system, and framework for third party application developers. Clearly the capability is there because various pre-installed applications (Office, Maps, etc) do this, but it's not available to developers like you and me.
now be done from the upgrade to handle with silverlight toolkit, this is the code you need to use for the button and assign it only created the animated tile, you can add more properties these are the ones I use.
private void CreateLiveTile(object sender, EventArgs e)
{
var newTile = new StandardTileData()
{
Title = "Draw Anime",
BackgroundImage = new Uri("icon2.png", UriKind.Relative),
BackBackgroundImage = new Uri("icon1.png", UriKind.Relative),
Count = 42,
};
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), newTile);
}
You could think about a workaround in your app, let user to decide which page will be his start page, pin app from menu, and on app start navigate to page user decided to become his start page.
It's really sad that we can't pin any page to Start Screen directly...
Has anyone implemented Tap & Hold in a Windows Phone 7 App yet? I can see a couple of possible approaches KeyDown/KeyUp and a timer or ManipulationStarted/manipulationCompleted and a timer.
However it strikes me that this is a less than idea approach because different apps would have different timer settings leading to inconsistency.
Am I missing something? I was hoping for a TapAndHold event
For all views Hold method is there.
It will handle long press function.
Silverlight Toolkit for Windows Phone adds easy to use gestures support, including On Hold gestures
I'm in the same situation, and I'm looking for "the recommended way". In the meantime, Mike Francis posted a solution on his blog, using Microsoft.Xna.Framework.Input.TouchPanel's gesture recognition within a Silverlight app. I didn't try it.
Start the Timer on Hold Event of GestureLister
and stop it on GestureCompleted event this is really a trick see detail answer on following link
How do I detect when toolkit:GestureListener Hold has stopped?
Button b = new Button();
b.Hold += new EventHandler<System.Windows.Input.GestureEventArgs>(HoldEventHandler);
The above code should work for touch and hold event