Convert managed VB.NET project to Windows Phone 8 project - converters

So, I am totally new to Windows Phone. My enquiry is very general. There are a lot of good API:s out there on CodePlex for example. I seem to have to create a specific Class library for Windows Phone 8 in order to reference it. My question is then if it is possible to easy convert a project (from ANYCPU class library to Windows Phone) or maintain two branches in some way.
Any information or insight would be appreciated!

It really all depends on what your library does. Answering the "how to convert a project" question has to be done on a case by case basis. Of course the general "yes you can do it " applies but it all depends on what you managed code is calling. Just like Silverlight is a subset of what you can do in WPF, the APIs available on Windows Phone is a subset of what is available on other platforms. (Which you don't specify). I would be happy to help more with more clarification.

Related

Understanding Xamarin [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
As a complete beginner to Xamarin and new entrant to mobile app development, I have some questions about Xamarin and about the way it works which I was not able to find on the internet
How does Xamarin Cross-platform actually work? Is it any use? I was told Xamarin told Xamarin is a cross-platform mobile development solution, but when I Start off, I see it actually encourages you to create separate projects for iOS and Android. I understand that is to give us more power and there is always Xamarin Forms if we want cross-platform UI. In that case, however, I would expect the Portable Class libraries to handle all the backend logic while the native projects are used only for the UI. But when I started out, the most basic library for accessing mobile functionality (Xamarin.Mobile), is not compatible with PCL. What is the use of PCL even in that case?
How are cross-platform apps generally made in Xamarin? What is the role of the PCL and how do we get it to do cross-platform stuff?
Is there no pre-built Xamarin API which allows to do most mobile-related stuff platform independently? Seems we have to download new libraries from nuGet for every little thing we want to do which is quite painful
I hate to ask this. But is the only real advantage of Xamarin the fact that we can code in C# instead of native languages? What I was expecting is actual cross-platform shared code-base. If unity can do it, why can Xamarin not do it?
As someone who's worked with Xamarin (certified) for more than 2 years I will try to answer your questions:
1) Xamarin is a .NET framework that compiles to native code for both platforms. 2 years ago you'd create projects for every 'type' of app you built (Android, iOS, etcetera). In practise this meant you writing Activities for android (in the .NET way of doing things, but with the exact same native android types) and UIViewControllers for iOS. Xamarin.Forms has been out for a while and is a solution that will allow you to share UI Code as well as Business logic.
2) Depending on the app, one chooses either Xamarin.Forms or the native route. In case of the native route you'd create views for every platform (Android AXML and iOS Storyboarding). Additionally a PCL would be added containing all the business logic. This way you can call
var authResult = AuthService.Login(username,password);
var settings = SettingsService.GetUserLocalDbSettings();
from both iOS and Android, and the business logic for logging someone in - only has to be written once. Xamarin.Forms allows you to also share UI, by building XAML-layouts in the Xamarin.Forms project. These get transformed to the right screen type in either OS. Note: This only works properly with simple layouts (think lists, tabs etcetera). Complex layouts take way more time in forms to the point you switch to native.
3) Xamarin is only the framework allowing you to write .NET for these platforms. There's a lot of plugins available (e.g. Connectivity check) that are available. Install them in your native projects AND the PCL, and you'll be able to check whether the app has connectivity from within the PCL, or not). Xamarin is the hammer, Nuget offers the nails.
4) You can share a lot of code (PCL). My honest experience though is that most of the time you'll be building layouts (views) for both platforms. The business logic (signing in, saving items to a SQLite database) costs the least time to build. UI / design however,....requires a lot more patience. So YES you can share all business logic (as far as the used libraries respect the PCL profile).
5) Protip: Xamarin offers some free university training since they have been part of Microsoft.
I agree with the comment made by Lex Li above that you seems to be quite new not only in Xamarin space but also in C# development space, but will still try to add to the points mentioned by Eric J which I think he has missed in his answers.
Answer to Question 1:
How does Xamarin Cross-platform actually work? Is it any use?
Already answered by people before me.
What is the use of PCL even in that case?
You didn't found the use of PCL because you didn't tried to use it correct way. It's not for accessing mobile feature from common code, It's used for writing code which is common for all the platforms example for such type of code can be 'Web Service call', 'Business Logic' etc.
Answer to Question 2:
This is a very generic question whose answer is given many times, by many people. The best place to know more about Xamarin is by following the Xamarin Developer Guide
Answers to Question 3:
As mentioned by Lex Li Nuget is core of .Net package distribution and you should use it not only because of this reason but also because it makes development and deployment more easy.
Like :
1) You need not to worry about where to store DLLs (GAC/Local)
2) No need to store a particular version of DLL in fear of loosing it, all the versions are stored on Nuget Servers and Visual Studio automatically downloads the one which is mentioned in you Package config.
3) You can choose to use pre-release version of any DLL in one project and Stable version in other with out worrying about any clash.
Answers to Question 4:
I think all the advantages are already mentioned in above answers, I would request you to first try working with Xamarin sincerely and then start ranting about it.
Unless you learn Xamarin as part of the larger C# ecosystem, the questions and answers will be hard for you to digest.
1 and 2: Kind of the worst questions. So many use Xamarin. PCL is dying if you really know how C# and .NET ecosystem go. .NET Standard and Standard Library will be the future, and have already been supported by the latest beta builds from Xamarin.
3: NuGet is the core of .NET package distribution (like npm for JavaScript) and every C# programmers should use it. If you cannot get used to that, well, nobody forces you to start your own tool chain.
4: Then why not use Unity? What are you waiting for then? Xamarin has its own target user groups, and those guys do appreciate that only the meaningful code should be shared. People do love platform dependent UI, as that can blend perfectly into native platforms.

Is it possible to develop the same application for Windows Phone 7 and Windows Mobile 6.x without much additional effort?

I have to develop an application for Windows Mobile 6.x and version 7 and my skillset is .net and web based. Since version 7 is not backwards compatible I am thinking that I will end up with a lot of duplicate work.
I had a look at Rhomobile and Phonegap but the later does not support windows mobile 6.x and the former would require ruby knowledge.
I thought that I could have as much logic in class libraries as possible and then "include as link" the classes into projects so that they can be compiled for the specific platform. I feel like I may end up with a lot of #if PHONE7 style logic in that case and also the user interface code would have to be implemented for each platform.
What is the most efficient way to solve this problem?
If you can separate the UI from the logic you can begin to multi-target. The other consideration is the runtime of the phone (Silverlight 4?) and the phone sandboxing giving you limitations.
MVVM Light is multi-targeted and is open source, you could use this to review how they tackled it:
http://mvvmlight.codeplex.com/SourceControl/changeset/view/d546dc69fffd
In short though, your "add as link" idea is pretty much the basis of it.
The other question to ask is will the application fit on both platforms? The usage style from mobile to metro is a big change. People expect things to behave a certain way and look a certain way on metro. If you can confine this to the UI and move as much logic out as possible, then you should be ok. But there will come a point where it isn't worth sharing, it is simply easier to duplicate.
Sorry for a lack of detail in this answer, to be honest it is heavily app specific. I would personally start with separate applications and refactor as commonalities appear, using a combination of linked code files and hash defines.
A cute trick... you can always make the classes partial and have a partial code file for each hash define:
MyBusinessClass.CF.cs
MyBusinessClass.Silverlight.cs

How to create Application name in multiple languages for Windows phone

say, I have created a WP7 app using the default language in English. The application name that will show in the Application List is English. Now, If I want to change this english-Application name to other languages such as japanese, Chinese,Korean. what I need to do? would appreciate your help with some samples or links of references or tutorial on this subject. It is ok to use part english and part other language to create application name?
This is described on MSDN here. It's a bit convoluted but it does work.
While Paul Annett's answer represents the official recommendations, it also requires that you have the tools for C++ development (which the Windows Phone tools do not).
Patrick's Blog (I've been unable to find a surname) has posted a tool called WP7 Localizer that generates the localized dlls without having the C++ tools installed

Is there any free XNA UI library?

I'm thinking of game in game user interface.
Check out XNAML:
http://msmvps.com/blogs/valentin/pages/xnaml-component.aspx
http://xnaml.codeplex.com/
[The] engine is designed to run in a
pure Xna environement on all supported
device. My engine is extensible, you
can add your own controls, inherit
from base classes (such as Control or
Pane) to make your own behavior. The
compatibility with Xaml is complete.
Create your interface on Blend and
make a simple copy/past action to add
the Xaml file in your Xna project !
Extract a C# code from a Silverlight
project and just add it to your own
Xna project !
I would definitely check out the suggestions the The ZMan has put up on this post. There are lots of UI libraries in his post.
I think you should look at this list:
I remember Crazy Eddie as a good GUI builder.
Probably a bare-bones approach (but anything XNA will be) would be the ScreenManager class as used by the Microsoft code samples. A guide to using it can be found in the Game State Management documentation.
Another possibility is XPF, an XNA-compatible library that seeks to replicate some of WPF's UI architecture. I use it myself - it's simple and elegant. It will be free for non-commercial use, with commercial pricing TBA.
(I haven't been able to load the XNAML website, but I'd guess XPF and XNAML have similar goals.)

Windows Phone 7 Samples

What Windows Phone 7 demo/reference applications have you seen which really made you interested in developing for the platform?
I know of Scott Gu's Twitter example and Foursquare. Also see here for MIX10 demo apps.
Other than developing games and re-creating functionality already present on other mobile platforms (iPhone, BlackBerry, Android), is there any good reference material and business benefits of developing for Windows Phone 7? Does the Silverlight dev environment really offer an advantage over what is already out there? My gut feeling is that this is definitely the case, but it will take some time for the platform to establish itself, if it does.
You can find a lot of examples and reference applications here www.reddit.com/r/wp7dev/ or search using the hashtag #wp7dev on twitter (full disclosure - some of my examples appear there).
There a examples of what people are openly working on, but one can assume it is a lot more - hopefully this is useful, as it shows what can be done, or is being done on the platform.
As a novice developer, other phone platforms came with a lot of overhead required to build even the simplest application. The fact that XNA will be available for game development is a huge thing for me, it means I can create simple games for me and my friends without having to spend time learning a new language or setting up awkward SDK's and deployment settings.
More advanced developers may scoff at that, but development tools that are already being used that can work right out of the box for the intended platform is important for the hobbyists. I think this will open up a huge arena for homemade games and apps just like XNA did for 360 development.
It should also help sales. I will buy a Windows 7 phone because of this, and I can imagine others will do the same. As it stands, I am going to port my existing XNA games over so I can play them on the go. It will be cool to show people at the office, airport, etc. projects I have made right on the spot, and even give them the option to play if they have the right hardware.

Resources