There's a new Windows Phone 7 project place in town...
- Posted: Aug 01, 2011 at 6:00 AM
- 6,219 Views
- 3 Comments
CodePlex is one of the more (most?) common place you'll find hosting Windows Phone 7 projects. It's a a prefect match for many developers, given that it's free, can host source, binaries, docs, work items and discussions and plugs directly into Visual Studio. That said, everyone is different and have different needs and likes.
There's a new, for Windows Phone 7 dev's anyway, project hosting location in town. One that many in the Microsoft sphere might not have considered or ever heard off, but in hindsight makes sense...
Who's hosting this mystery project site? Nokia! Yep, that Nokia.
And surprisingly enough, today's project is hosted there and comes to us via a comment left on a previous post.
Simple Silverlight example demonstrating use of accelerometer sensors to calculate the inclination of the device and presents this as a traditional bubble level.
General
BubbleLevel Silverlight is a port of Qt Bubble Level Qt application, more information about the port can be found from the porting story page.
Of special note is the wiki pages where you'll find a great story on how this project was built and also how the porting was done.
It's a simple app, but sometimes simple is all you need (less is more and all that). Here's a snap of the project and a code snip.
/// <summary>
/// Updates the position of the bubble in the glass tube.
/// </summary>
/// <param name="e">Contains the accelerometer reading value.</param>
protected void UpdateBubble(AccelerometerReadingEventArgs e)
{
const double RADIANS_TO_DEGREE = 57.2957795;
double divider = Math.Sqrt(e.X * e.X + e.Y * e.Y + e.Z * e.Z);
// Calculating the angle + using low pass factor 20 %.
// Values from all three accelerometers are used to get more precise reading on y-axis.
m_Angle += (Math.Acos(e.Y / divider) * RADIANS_TO_DEGREE - 90 - m_Angle) * 0.2;
double angle;
// Depending on the orientation, invert the accelerometer value
if (Orientation == PageOrientation.LandscapeLeft)
{
angle = -m_Angle + m_CalibrationFactor;
}
else
{
angle = m_Angle - m_CalibrationFactor;
}
const double MAX_ANGLE = 20.0;
// Restrict the angle value to the range -20 and 20 degrees.
if (angle > MAX_ANGLE)
{
angle = MAX_ANGLE;
}
else if (angle < -MAX_ANGLE)
{
angle = -MAX_ANGLE;
}
// Set the bubble position.
BubbleTransform.X = angle / MAX_ANGLE * (Reflection.Width / 2 - Bubble.Width / 2);
}
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.



Follow the Discussion
'Other' Ian & I use this site to share our code for Goblin Harvest - still to make better use of the other features (WIKI etc) but its a nice alternative to CodePlex.
https://projects.developer.nokia.com/GH
This is really excelent web resource for WP developers.
After exploring the site, my question is Ovi Store and Microsoft Marketplace will be integrated in way that Microsoft Marketplace will be available to 180 countries like Ovi Store?
Excellent, the more the merrier.
Remove this comment
Remove this thread
close