Why to use UriMapping in WP7? - windows-phone-7

Can someone explain me the meaning of UriMappings in Windows Phone 7 and why to use them? I mean why I will need user friendly uri's in a phone app?

UriMappings are part of the Silverlight 3 navigation framework and since WP7 is a Silverlight 3+ port is supports the same API. You don't "have" to use UriMappings if that doesn't jive with your programmatic zen.
A lot of Silverlight developers come from a web background (ASP, PHP, ASP.Net, et al) and as such a very comfortable with the idea of short, hackable, persistent and structured URLs for navigation. Navigation is really an odd thing on any UI platform (even on Silverlight) and as such enabling developers to be successful in it is really all about giving as many options as possible.
Personally, I choose not to use UriMappings in WP7 apps but have my own mini-navigation framework which resolves page names to XAML URLs. There's an example in my open source NavigationService.GetParseUrlString() method and Pages class.
As a side-note, In future releases of WP7 operating systems and WP7 developer tools it might be possible for the emulator/phone to show a full history of Pages in the Back stack. In Mix10 that was demoed as an internal Microsoft capability. Which means that if you have a meaningful page UriMapping it'll be easier to debug.

Related

New Windows Phone 8.1 Silverlight App

I am writing a new Windows Phone 8.1 Silverlight App BUT WITHOUT MVVM/MVC.
I have to implement Push notifications to this app sooner.
This app must run in the background
Will this be possible without MVVM/MVC?
Also, please tell me where from to learn MVVM/MVC from beginning?
It's definitely possible to develop apps that do not follow the MVVM or MVC patterns. You can develop your apps however you like; these are merely architectural patterns that many programmers follow when developing Windows Phone apps. MVVM, in particular, is suited to Windows Phone app development (and WPF) because of the data binding mechanism provided by XAML.
For example, you might choose to write your code entirely in code-behind (*.xaml.cs) files and subscribe to events directly on the view. This might be fine for small apps, but may not be suitable for larger apps, especially when there are multiple people working on different parts of the app (e.g. a designer working in XAML and a coder working in C#) and when testability is extremely important.
I won't provide links to learning materials for MVVM/MVC; a mere bing search results in an abundant amount of information at your fingertips. Good luck!

Web Application in place of a more traditional UI?

I am considering using a web application in place of a traditional UI to control an imaging system. The UI will allow the user to do things like change settings, upload scripts, start/stop data acquisition, view data, etc... Rather than a monolithic UI that "does everything", an embedded controller would interact with system hardware and control the process, receiving commands from the UI over a local network.
I would probably use a javascript toolkit or perhaps some .Net technology to build the web application. A few of the advantages I see are:
Access UI from any browser.
No software to install.
Access remotely if necessary.
View status/data from multiple computers simultaneously.
Modular (separation of concerns)
Data as a web service.
A few of my concerns would be:
Lack of a comprehensive widget toolkit.
Supporting multiple browsers, this may not be as bad as I think now with HTML5.
Updating the UI from the server.
My questions are, Is this common? Is it a bad idea?
If it's really subjective, I understand, however, I just wanted to see if there is an obvious answer, like "DON'T DO IT!!!!"
It is very common. I do it all the time, particularly for a closed community of users such as you will have.
It might be different if this was a public facing device, but it is not.
You are going to support more devices by saying "you must have an HTML 5 browser" than if you said "You must have a PC" or "You must have a Mac"
In terms of your concerns, I do not see any of them as being an issue.
It is easier to deploy a UI upgrade once to the imaging controller than many times to all of the client machines.
There are all of the widgets that you could ever want available for HTML 5 compatible browsers
You answered your own question about cross browser issues. HTML 5 browsers are free so there is no downside for people to upgrade to them and you have the entire weight of the world wide web pushing them to upgrade to take advantage of what can be done with HTML 5 so users have a big incentive to upgrade. I do not run into any push back when I require a closed group to use an HTML 5 compatible browser. And if you want to be kind to those that don't have html 5, you can always use modernizr.
It is a good idea - and there is plenty of examples and ways of doing what you want to do.

Windows Phone 7 : developing UI without xml

We are developing an Windows Phone 7 mobile application. We are new to this platform. In our application, screen will be dynamically generated. So we would like to render the UI
programmatically - without using any xmls. Please share some example code or resource or links, wherein UI is rendered programatically. In case of iPhone development, we referred "UICatalog" example. We are looking for similar type of example
It is possible to render the UI in code, though the examples of doing so are few and far between because it's a rare thing to do with XAML-based technologies like Silverlight and WPF. Instead, you tend to find that developers use to databinding and data templates to present generated content.
If you are porting an application from iPhone to Windows Phone (or even if you're just starting from scratch), the best thing to do is to firstly make sure that you understand the development platform. There are some great resources for this on MSDN here: http://msdn.microsoft.com/en-us/wp7trainingcourse_wp7gettingstarted_unit.aspx
The next thing to do is to make sure that you understand the Metro design language that Windows Phone is built upon. Here are some great resources in that respect:
Metro Design Language for Windows Phone 7
Microsoft design .toolbox
From Transportation to Pixels
Once you've reached this point, you will most likely realise that your current approach isn't the right one and switch to a databinding and data templates approach :)
If you are doing an iPhone port, it's important to realise that the design approach is different for Windows Phone applications. Content is King, so work out what that is, put it "front and centre", and trim away every thing else.
I hope this helps.
You may want to investigate the XNA path for Windows Phone development.
Developing with SilverLight but choosing not to use the most useful features of the platform is probably not going to be fun.

Web technologies in GUI apps

What's your experience in using web technologies (HTML, XML, CSS, JavaScript) to implement part of the functionality of a GUI application? Pros and cons, please.
No servers, relational databases, AJAX, or cookies for session management, nor an existing webapp either, but rather a GUI app that uses web widgets (like Qt WebKit) to render and handle substantial parts of the UI, while taking advantage of a GUI framework to achieve an even richer interaction and better desktop integration.
I've already validated that the approach is possible using PyQt. Content can be rendered from the file system or from strings, and URL requests (images or clicks) can be captured and served by the form's event handlers. CSS and JavaScript are supported, perhaps with some limitations.
# ...
self.webView.page().setLinkDelegationPolicy(
QtWebKit.QWebPage.DelegateExternalLinks
)
#...
class TotiMainWindow(QtGui.QMainWindow):
def linkClicked(self, url):
pass # events arrive here
Note: This question is different from this one and this one made before, among other things because there is no requirement to use web technologies on the GUI, but there is the requirement that the application should work without a network connection available, and should integrate well with the default desktop over different platforms, without previous infrastructure requirements (no .NET, Java, browsers, or database servers).
Note: I posted a different version of this question on PMS but found very little experience with this approach there.
Closing Note
I just found most of the information I was looking for in a series of blog posts by André Pareis.
I think the largest advantage to using web markup like HTML/CSS and other web technologies is that desktop apps may very well have their days numbered.
As we speak, Google engineers are working on the Chromium OS, which essentially consists of a single GUI application... the browser...
Now, while nothing may never actually come of it, there is clearly a rising trend in the number of applications accessible through a web browser, accessible anywhere. It seems to me that this is the future of application development.
By using these technologies, this becomes one less headache you have to deal with when or if you determine that your app should be available as a web application.
Update: A few years ago, we developed an Agent Desktop for our call center that is essentially a local application that opens sockets to integrate with the phone system. The user interface the agents use is built with HTML, CSS, and JavaScript, and the experience is stunning. When we released our latest update in 2010 with a professional CSS redesign, our agents were all very impressed with not only how easy it was to interact but also how easy it was to use.
In the future we will port this 100% to the browser, but for now it needs to be a local application because of the COM integration with the phone system.
We did exactly this for a project back when Windows XP was new.
This gave my team several benefits:
A good-looking UI with relatively little effort
Easily change the style of the UI in a consistent manner using CSS
Relatively simple integration with C++ (invoking functions from the ui and vice versa)
The drawbacks we saw were:
Some not-so-good firewalls considered accessing internal resources (ie other html pages in the ui) to be a web request
Adding and accessing the needed resources could in some cases be a bit cumbersome
It was possible set properties in Internet Explorer that would prevent JS from running in the application
Note that some of Windows XP:s programs are using this approach.
This probably works best with small, more Wizard-like parts of the ui (which our ui consisted almost entirely of).
I have since then not really been involved in ui projects, so I cannot really tell you whether this approach is still valid... I know that MFC-based applications will let you use HTML-based dialogs though.
In a similar situation in 2005 I created a stand-alone webapp using XForms, CSS, JavaScript, XML and XML Schema for offline data retrieval and verification. With a good XForms -> HTML + JS transformer (Chiba) it did the job with no bug fixes after the initial release. It was used for 6-12 months (IIRC) by about a dozen engineers for a project gathering test data in the tunnel of the Large Hadron Collider. The biggest surprise of that project was just how much you get for free when going for a web platform, even for offline use. Highly recommended.
The major problem is that it reduces your development speed, or the quality of your user interface. A lot. Unless you're using Seaside, it is much faster to develop a desktop app.
There is quite some number of applications built on top of Mozilla platform. It isn't 100% web technology, as instead of HTML you use XML based XUL, but the rest is indeed web stack (JavaScript, CSS). The most successful of these it the OpenKomodo and it's commercial big brother Komodo IDE.
On the other hand, as far as Qt goes, the newest version 4.7 you can build GUI using QML language. Don't let the name mislead you, it's not markup, it acctually JavaScript with app-specific extensions.

Any designers or libraries for creating "Vista-style" web pages?

I'm looking for a way to create websites with the cool stylings of Windows Vista, like what is shown in this screenshot (taken from one of Microsoft's websites):
Any suggestions? I'd prefer an integrated designer / IDE, but libraries or templates might also help.
FYI, the answers before this were in response to a very poorly worded question. The OP did not make it clear that they were after a web page. Thanks to Shog9 for picking up the slack there.
This is NOTHING to do with WPF or VS 2008. Its a WEB application!
Lots of control vendors have produced some great looking controls, check out the ASP.NET controls gallery there is some cool stuff there. Another well-known vendor is Telerik who have created some real nice ASP.NET AJAX controls.
Note, this is not to promote their tools, I personally have not used them, they are popular, and it's just to give you the heads up.
In short, the look is pretty much fancy imagery. Unless Silverlight is used, which uses a subset of WPF and requires the plugin to be installed on the users browser, and requires VS2008 to create.
In terms of the screen shot, most of that is nice imagery, the buttons are probably rendered like that because you are running Vista, however, they could also be replicated without Vista. The page you show is not a Silverlight page, so it is not a requirement.
Have a Google for "ASP.NET vista style controls" there's tons of people after the same stuff :)
It's not a matter of what software to use - use whatever you normally use to design websites. If you want to make a web page that looks like one you see online, you can very easily obtain:
The HTML markup on the page
The CSS style sheets used by the page
The images used on the page
The Javascript used on the page (although this is less likely to be useful, as in most cases it will have been compacted and obfuscated).
Also Delphi 2009 ;-).
As mentioned Visual Studio 2008 has WPF (Windows Presentation Foundation) based development tools in it. Have a look in your Project templates for WPF Application along with WPF Browser Application and WPF User Control Library. All of these pertain to Vista WPF.
The "cool Vista stylings" are done using WPF, for which you'll need Visual Studio 2008. 90-day trial downloads are here. The "Express Products" (free, stripped-down versions) are here.

Resources