I having problems finding documentation or examples regarding the proper way to use the Accelerometer to trigger a Shake event. Seems like it should be easy, but all the examples are 8.0 which apparently are using Microsoft.Devices.Sensors;
Apparently you are supposed to use using Windows.Devices.Sensors; which you would think are the same, but things like Start() and Stop methods no longer exist. I was trying to use a Microsoft AccelerometerHelper class from Microsoft and it also uses the older namespace. The Shaken event in the Accelerometer class is only triggered on the tablets and not phones according to:
MSDN : here
Windows Phone 8: The accelerometer sensor does not raise the Shaken
event on the Windows Phone 8 platform. If you add an event handler for
the Shaken event in your Windows Phone 8 app, no error is raised, but
the code in the event handler won’t run.
The last resort or another option if you can't port the code to WP 8.1 Runtime is to switch the project to Windows Phone 8 Silverlight or even 8.1 Silverlight, all code work perfectly, I've worked with AccelerometerHelper class before and face the same problem.
Related
I am using the Windows-Universal-Samples BluetoothLE sample as a starting place to connect to a Polar heartrate device, but ultimately i want the functionality in a desktop application. Using the WIndows 10 SDK (10.0.15063.0), I created a standalone class library to provide the functionality of connecting to this Polar device and i copied over parts of the sample code for the bluetoothLE Scenario2_Client.xaml.cs. I can get everything to work in the class library except no matter what ive tried i cannot get the ValueChanged event to fire when subscribed to the GattCharacteristic for the HeartRateMeasurement characteristic of the HeartRate service. if i run the bluetoothLE sample code, i can connect to the Polar device and can select that service and characteristic and the ValueChanged events fires as expected.
Is it possible the Windows 10 SDK 10.0.15063.0 has issues with the bluetooth api? prior to the release of the creator's edition, i could get the valuechanged event to fire, but that was using an older version of the bluetooth api stuff and most of it stopped working once the windows creator edition was released, so i am having to rewrite it.
I suppose its possible that there is something wrong with my code, but i did copy a lot of the basic connection and subscribing to the event from the bluetoothle sample. the only difference is that I am using a WPF app for the UI, but the bluetooth code should be very similar
this is my rewrite code. the HeartRateMonitor class is the basic implementation that connects to the Polar device, sets up the heartrate service and characteristic and subscribes to event, plus start the notify.
https://github.com/kirk-quinbar/HeartRateLE/tree/rewrite
been playing around with this for a week and so far cannot get the ValueChanged of the characteristic to fire as expected. driving me nuts. any thoughts on things to check for, or anyone is welcome to check out my code above for suggestions.
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
I am new to wpf. Hence, kindly co-operate with my questions.
I want to build an app that runs on windows tablets. This is not to windows store app, rather, I will be developing this app for some company to visualize the data they have. And they will use this app on tablets or other touch enabled devices.
Background:
App will have some graphs and other visualizing diagrams. And WPF MVVM pattern will be used to develop the app.
My question:
My current system is:
System: HP elite book revolve 810 g2 tablet
.NET Framework: 4.0
Visual studio 2012
Can I develop a tablet app with the above specification?
where can i find coding documents on coding for touch devices in WPF mvvm pattern?
How can I use graph or any other visualization method in wpf. I mean, do I have any library that provides API's for different graphs?
Please help me in answering above.
Thank you
This questions will lead to long answers.. I´ll try to make it short!
The elite book revolve has an I5 and Windows 8 / 8.1. You should not have problems developing Widnows apps with that.
Visual Studio 2012 is fine as well, you might want to download the windows phone toolkit (if you want multiplatform apps).
You will need to use framwork 4.5 to develop Windows 8.1 RT apps though - and this is what you want to do if you want multi device apps. If not then it`s just normal Windows applications that can olny be runn on Windows devices (not Windows phone, or RT tablets)
It seems you are a starter in developing Touch apps.
2.1 Honestly you should consider buying a book before developing. The "Windows 8.1 Apps with XAML and C# Unleashed" one is really good
one - you can even read a good share of the first chapter with example code (see links below)!
2.2 I added a few links to ressources that could help you. Consider looking at MVVM, WPF and Touch coding independently. There are tons of tutorials available!
2.3. Doing touch support is pretty straightforward, it`s just another event handler (touchdown instead of mouseleftbutton down) so all you need is to know how to best handle events in MVVM (link attached below). Another thing is gesture support (see link)
Here is the standard library of xaml controls.. pretty basic but you can do a lot with them: https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh465351.aspx
if you need better /more graphical controls you might consider using Developer Express or similar APIs
heres a list of the graphic tools they provide. Pretty neat: https://www.devexpress.com/products/net/controls/winrt/
Theres also a WinRT XAML Toolkit available: https://winrtxamltoolkit.codeplex.com/ (Tutorial and Graph Preview see below)
Additional Links:
Windows 8.1 Apps with XAML and C# Unleashed (example with code):
http://ptgmedia.pearsoncmg.com/images/9780672337086/samplepages/0672337088.pdf
MVVM General developing: https://joshsmithonwpf.wordpress.com/a-guided-tour-of-wpf/
MVVM in Windows 8: https://msdn.microsoft.com/en-us/magazine/jj651572.aspx?utm_source=rss&utm_medium=rss&utm_campaign=mvvm-using-the-mvvm-pattern-in-windows-8
WinRT XAML Toolkit Tutorial (Windows Store example):
http://eren.ws/2013/10/15/using-graphs-and-charts-in-windows-store-apps-boredom-challenge-day-11/
Best way of event Handling in MVVM (needed for Touch event handling):
What's the best way to pass event to ViewModel?
My app is ready and is too simple, just a panorama and some pivots, nothing specific to windows phone 8.
Before sending it I want to make sure that it will work on WP8 and also WP OS 7.1. I saw in the documentations that if we target 7.1 it will work on 8 too, but at the first I have choosed targeting windows 8 and now seems I can't change it in the App properties.
How can I know if it will work on OS 7.1 properly? ( I have not access to emulator, just a WP8 device)
How can I make it to work on both systems?
just a panorama and some pivots, nothing specific to windows phone 8.
Panorama and Pivot are specific to WP8, as the implementation of the controls were completely changed to have better performance on WP8.
So your code won't be compatible with 7.1 at all. So unless you want to write a WP7 app and let it run on WP8 with worse performance than a WP8 app, you cannot have a shared UI codebase.
For libraries, I'll recommend using Portable Class Librarie
Your 7.1 app will work fine on Windows Phone 8 without any additional modifications.
I believe you meant that you have access to the emulator only and not a device, otherwise it would be really easy to check how the app behaves on Windows Phone 8 hardware.
The Interaction Context is a new library of touch and gesture on Windows 8(http://msdn.microsoft.com/en-us/library/windows/desktop/hh448840(v=vs.85).aspx).
I am wondering if I can use it for a C# winform app or a WPF app.
Yes, as long as you're targeting Windows 8. Have a look through out the documentation and you'll see "Minimum supported client Windows 8 [desktop apps only]" all over it.
Here is another link you may find useful:
Is there a way to simulate touch events in Windows 8