The service having id "google_buzz" is missing, reactivate its module or save again the list of services.

Windows Phone

Welcome the winning ecosystem!

Windows Phone Nokia Lumia 800Windows Phone Nokia Lumia 800Past months have been a real roller coaster ride in the interesting land of Mobile Business. New players have been gaining more and more market share and the dynamics have changed in all fields. I think none of us could believe this will happen five years ago.

It is reality and it has forced the older players change their thinking and accept their position as a new challenger. And personally I think it is a very good thing. You have to re-think your business and re-invent yourself.

I have seen the huge changes inside Microsoft when the whole company has changed to execute the cloud strategy that contains multiple screens like PC, tablet, phone and TV. I see new emerging technologies like HTML5 and new tools that support them and give our partners to innovate and build new experience.

As a Finn, I have also seen the dramatic changes in Nokia. The partnership announcement between Nokia and Microsoft has literally changed the lives of many in Finland and has impact to thousands in the ecosystem.

But the changes are always an opportunity and a start of something new. Microsoft and Nokia has joined they forces and are already in a full speed building the Third Ecosystem. This will be totally new kind of ecosystem and the first glimpse of future can been seen in Windows Phone 7.5. But this is only the start.

Welcome to start to design and plan new mobile solutions and services that scale to multiple screens. The role of Metro UX is huge. You’ll find all the tools and a phone emulator for free in App Hub.

Make sure to increase your readiness so you’ll understand all fundamentals of Windows Phone 7.5. And then register to Marketplace as a developer and show to the world what you can do with a new kind of phone – Windows Phone!

Go to http://create.msdn.com

Vesku Paananen
Windows Phone Lead, Microsoft Finland
www.vesku.com
Twitter: @kitevesku
Blog: http://mrwpf.wordpress.com

 

WP7 Mango and HTML5 applications' gestures

0
0

I was trying to implement gestures in my prototype application for WP7 using HTML5/javascript and faced few interesting problems. After searching for solutions in developer forums, I gathered some useful information that helped me achieve the goal.
The setup - using WebBrowser control as root component in my application, to render locally available html/javascript content. My idea was to use only gestures to modify data cell content in a table, instead providing other methods to select or input the content. In short, I have numeric values in a table and would like to enable the user to select the cell and than increase/decrease the current value by swiping finger over the screen. For this to work I needed to get the manipulation delta event to work in my application.
The problem - WebBrowser component consumes these manipulation events, so they are not offered to your web application. In addition, I did not like the all the time popping copy/paste while selecting a cell in my table.
So, the search led me to few useful articles:
http://www.developer.nokia.com/Community/Wiki/Creating_GUI_applications_for_Qt_and_WP7_using_HTML - addressing the creation of HTML5 project and enabling communications between your WP7 application and javascript.
http://www.scottlogic.co.uk/blog/colin/2011/11/suppressing-zoom-and-scroll-interactions-in-the-windows-phone-7-browser-control/ - some useful information about the visual tree structure of WebBrowser component in WP7.
Ok, so armed with this knowledge I approached my problem as follow:
1. In WebBrowser.LoadCompleted callback I got to the Border child consuming the manipulation events, according to second link article it is the fifth element in WebBrowser children tree:

\-WebBrowser
  \-Border
    \-Border
      \-PanZoomContainer
        \-Grid
          \-Border (*)
            \-ContentPresenter
              \-TileHost

private void WebB_LoadCompleted(object sender, NavigationEventArgs args)
{
var border = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(WebB, 0), 0), 0), 0), 0);
if (border.GetType().Equals(typeof(Border)))
{
(border as Border).ManipulationDelta += new EventHandler<ManipulationDeltaEventArgs>(WebBBorder_ManipulationDelta);
}
WebB.InvokeScript("onDeviceReady");
}

As you see, first got the Border element, than register a callback to delta event and at the end inform the script that WebBrowser is ready with loading the content.
Now I have the possibility to use the delta manipulation event, so in the callback:

double lastTouch = 0;
private void WebBBorder_ManipulationDelta(object sender, ManipulationDeltaEventArgs args)
{
args.Handled = true; // handle the event to avoid scrolling the viewport
//however, we need the event to trigger the javascript action, so
double x = (args.CumulativeManipulation as ManipulationDelta).Translation.X;
double y = (args.CumulativeManipulation as ManipulationDelta).Translation.Y;
double d = Math.Abs(x) + Math.Abs(y);
if (d - 30 > lastTouch)
{
WebB.InvokeScript("onDeltaIncrease");
lastTouch = d;
}
else if (lastTouch - 20 > d)
{
WebB.InvokeScript("onDeltaDecrease");
lastTouch = d;
}
}

The main achievement is the event cancelation at args.Handled=true;. The rest is just a calculation suitable for my case, but you may prefer to send the manipulation delta to your javascript and do any logic there. I just have two simple scripts invoked to increase or decrease the selected value.
Oh, and yes, I chose to disable the copy/paste in my table tag by adding event handler as onselectstart="return false".
Now, the result is
a. my application WebBrowser viewport is not scrolling and instead of consuming the manipulation events, I intercepted them and have a choice to call my script with their data.
b. this would enable me to use multitouch events to manipulate my html data.
c. got rid of unwanted copy/paste popup
Be aware that there is a good cross platform framework. PhoneGap, enabling many functionalities, but if you are not targeting cross platform deployment, or even if you are, you might need to do similar workarounds in your applications for HTML5. The reason is, as example, the gestures are not addressed by PhoneGap, and in any case, you may need different functionality depending on your application needs. 

Comments

Jani Naukkarinen's picture

Hi All, Also from my end,

Hi All,

Also from my end, welcome all to this new expert area within Sfonge. Our goal is to collect and bring together resources, experts and best development tips on this space.

Feel free to drop in and share your experiences with Windows Phone development so far!

Cheers,

Jani

Syndicate content