⬆️ ⬇️

WinPhone DevHub - a mobile application that should be at hand with every WP7 developer

Almost all WP7 developers use third-party control libraries in their work. As a developer, did you go through what would download examples for a specific library, compile and install it on your phone? Were there any moments when you were looking for a suitable icon for ApplicationBar? How long did it take to find her? And, probably, they wanted to be aware of when new icons appear? Do you want this and something else to be collected in one free application for Windows Phone? If yes, then welcome to the cat, where you will find a description of the WinPhone DevHub application and some technical details of its creation.



I myself am developing on Windows Phone and often have to put on the phone examples of controls from different libraries. This is not only long, because you need to download the library, compile it and run it on the phone, but also reduces the number of available slots for developer applications (now this number is ten). Such a waste of time terribly frustrated me, because, for example, Telerik has an excellent demo application in the Marketplace, which contains examples of using RadControls. I turned to the developers of such libraries as the Silverlight Phone toolkit , Coding4Fun toolkit , amCharts and asked if they were planning to release an application with examples for their libraries. All the developers said they did not see the point. Then the idea arose in my head to gather examples of popular libraries together and release it as an application.



Reflecting on the fact that something else useful for the developer can be added to the application, I came to the conclusion that the icons for ApplicationBar are in great demand, because used in almost every program.

')

Thus, for the first version of the application, I decided to implement support for examples of controls of several third-party libraries and add several popular icon sets.



I selected the following control libraries:







When a library is selected, the corresponding demo is loaded.







It probably makes sense to add other libraries of controls, but for the first version of the presented set it is enough.



Among the sets of icons, I chose three:







Since the development is carried out on a desktop machine, and the examples are open on the phone, a very important feature that is implemented in the application is the ability to get detailed information (including a download link) about the toolchain presented in the program. To do this, call the context menu for the corresponding set on the main page of the application and send yourself an email with detailed information.







The application allows users to send a proposal to improve the application using the Uservoice service (see the About tab or the section Your last About Dialog ).



Some technical points


All demo applications are taken in the form of projects from the corresponding libraries and included in the solution solution. The solution has a main application that displays links to go to the corresponding control library application.



Initially, the application was written without observing the MVVM pattern: the main goal was to take demo applications, include these projects in my solution, display links to the main pages of each demo application and everything can be enjoyed! As practice has shown, this approach allows you to make a one-time application, since it is almost impossible to expand it, the code looks like a classic spaghetti code, the implementation of a little bit complicated automation is very difficult, etc. The application is currently being rewritten using MVVM.



Naturally, at the beginning on the main screen I placed buttons with hard-coded paths to hard-coded demo applications. I had to prescribe everything with my hands, which was tedious and not convenient. In the end, laziness won and I created an xml file in which I put all the relevant parameters for each library, such as the application name, the path to the icon, the path to the main application file, etc. This allowed us to implement an algorithm that reads the xml file and forms the source data for the listbox. If it comes to me (and it definitely comes to me!) The idea to add a new demo project comes to my mind, then I just update the xml file, add this project to the solution and that's it!



<ControlToolkits> <ControlToolkit> <Id>1</Id> <Name>Coding4Fun Phone Toolkit</Name> <Version></Version> <MainPageUri>/Coding4Fun;component/MainPage.xaml</MainPageUri> <About></About> <Author>Coding4Fun</Author> <ImageLogo>Images/Coding4FunLogo.png</ImageLogo> <Background>#FFF09609</Background> <ToolkitUrl>http://coding4fun.codeplex.com/</ToolkitUrl> </ControlToolkit> <ControlToolkit> <Id>2</Id> <Name>Silverlight Phone Toolkit</Name> <Version></Version> <MainPageUri>/SilverlightToolkit;component/MainPage.xaml</MainPageUri> <About></About> <Author>Microsoft</Author> <ImageLogo>Images/SilverlightToolkitLogo.png</ImageLogo> <Background>#FF1BA1E2</Background> <ToolkitUrl>http://silverlight.codeplex.com/</ToolkitUrl> </ControlToolkit> .... </ControlToolkits> 


With icons, the story is similar, but laziness defeated me much faster, because the number of icons is much larger (more than 700 at the moment), and I wanted to achieve the next level of automation of my work: when updating a set of icons, I will only have to unpack the icons in the corresponding project folder, in VisualStudio see which new files have appeared and add them to the project. Compiling, launching the application and opening the corresponding set of icons is all you need to do to see the new icons on the screen. Thus, I created a similar xml file where I specified the path to the folder where the library icons, author, description, etc. are stored. Reading data from the xml file is done using Linq-To-Xml technology.



 <IconSets> <IconSet> <Id>3</Id> <Name>Templarian Pack</Name> <Version>1</Version> <Path>/Icons/Templarian/</Path> <About>This is a project started a few months ago to supply creative commons licensed icons to Windows Phone developers. If you found these useful feel free to buy me a beer with the donate button in the footer.</About> <Author>Austin Andrews</Author> <Background>#FF00ABA9</Background> <PanoramaBackgroundPath>Images/PanoramaBackground4.jpg</PanoramaBackgroundPath> <Url>http://templarian.com/project_windows_phone_icons/</Url> </IconSet> .... </IconSets> 


Here I was waiting for a not very pleasant surprise, because I can not get a list of resources that are stored in my project for a given path. The only option is to mark such resources as Embedded Resource , and then filter the necessary icons. On the other hand, icons marked as Embedded Resource cannot participate in Data binding, which forces them to write additional code. The solution came suddenly - I can generate any files based on the metadata of the current project (files, folders, their location, etc.) using a tool like T4 , which is built into VisualStudio. A few lines of code and I have another xml file that contains the paths of all the icons that I will display. By changing the attribute of icons from Embedded Resource to Content , I can use them in the binding process, which will improve performance and simplify the code. The code generation solution will be used in the next release of the application.



It should be noted that the approach using xml files as a data source for building elements on the user interface is also used in the Your Last About Dialog library. It is only necessary to set the initial data (names, description, addresses, etc.), and the system itself will build the user interface according to all the rules of Metro applications.



In this application, I decided to try out solutions for analytics and error tracking.



I decided to get analytical information through the Flurry service. This service provides a library for Windows Phone, the connection is very simple - one line in the App.xaml.cs file, sending a specific event is another line. The main thing is to think about what events it will be useful for you to receive and what parameters of the event should be indicated. In WPDevHub, I keep track of which libraries of controls and icons users visit, as well as the description of which libraries users send to themselves by mail.



For bug tracking, I use the bugsense service (it was already mentioned in the Habré in the article about creating the Movie Search application). This service is also connected by adding one line to the file App.xaml.cs The service is very convenient and extremely useful, despite the limitations that are laid down in the free version of the account. A free account allows you to store errors on the server for 7 days (notification of new errors arrives regularly), to receive no more than 500 errors per month. The service provides detailed information about the error itself, including stacktrace, phone details, OS version, country, network connection type, error rate, etc. A very convenient feature is the ability to mark the error as fixed, if the error is already fixed in the code and should not be more send email notifications about it. But all cases of the occurrence of the error itself, of course, will be taken into account when generating reports by the system.







It should be noted that the overwhelming majority of errors were revealed in demo projects. This is understandable, because these projects have not been tested with the care that is required when passing the certification stage in the Marketplace. Bugsense worked very well and I had a dozen bugs in the demo applications that should be fixed in the next release.



Bugsense provides an opportunity to take advantage of the premium plan for open source projects (for ordinary projects, the cost of such a plan is ~ 300 USD per month). I will not fail to take advantage of such an offer and will soon publish the project under an open license.



As a monetization mechanism, I chose the display of advertising. I use Microsoft PubCenter as an advertising provider, which has one of the highest rates for advertising. Unfortunately (to my regret: P) AdControl hidden and does not show ads if the user has regional settings for those countries that are not supported by these advertising providers. For example, Belarus and Russia are not supported. In one of the following versions, I plan to upgrade to Windows Phone 7 Ad Rotator , which allows you to use several advertising providers at once and, thereby, maximize revenue.



In the next releases I plan to remake the design of the main page so that new entities and new features can be added. For example, I want to add a few cheatsheets (such as design guidlines, certification, checklist when publishing an application, etc.) that will be useful to developers, add new libraries of controls and icons, and something else.



I hope that WinPhone DevHub will become a desktop (handheld?) Application for all developers on Windows Phone, and I will be able to satisfy all desires for improving the application. If you have any ideas what else you can add to the application, I’ll know the date by any means.



If you download an application, do not be too lazy to rate it in the Marketplace (from the About tab or from Your Last About Dialog).



Link to the application in the Marketplace.

Link for custom tips and ideas.

Mail for feedback.

Online business card .



Source: https://habr.com/ru/post/142204/



All Articles