Using SAP or PCL in Xamarin Forms Travelling Application - xamarin

Hi I want to use TravelPort API Sample Application(C# Console Application) in my Xamarin Forms Project but I am not able to use namespaces like System.Configuration and System.Service Model in my PCL project.
Later I came to know that I should use DI(Dependency Injection) in my PCL project to use these namespaces. Then I started learning DI.
My question is that I am targeting Android Platform only in my Xamarin Forms project.And I just want to use Flight Search and Flight Booking features from TravelPort Sample App.
So is it convenient to use Shared Application Project rather than a Portable Class Library Project? And Will I be able to use System.Configuration and System.ServiceModel namespaces easily in SAP ?

Related

No portable class library folder found in Xamarin Forms

I am a newbie working with Xamarin Forms in Visual studio 2019.
When I create a blank page for Mobile App(Xamarin.Forms) , I do not see a Xamarin.forms portable template app in my project solution.
There is no PCL anymore. PCL is outdated. Just use the Mobile App (Xamarin.Forms) template. It will create all you need.
The core project (that contains your shared code) will be a .net standard project.
.net standard is way better than PCL, because you don't have a artificially limited set of APIs.
this creates the following 3 projects
Your shared code should go into the App8 project

Not able to find out Portable Class Libraries project in visual studio 2017 when creating cross platform app

Hi when i am going to create new xamarin forms app I'm not able to see Protable Class Library in the Sharing Code Strategy options in VS 2017 .enter image description here
Please help me in this
That's the expected behavior, it's no longer possible to create a PCL library with Visual Studio 2017 as they've been replaced by .NET Standard libraries, see here for more details.
Also, the roadmap and the comparison with PCL profiles is available here, so you can determine the right .NET Standard version for you depending on your target framework and the APIs you need to place in the shared library.
.NET Standard libraries are the replacement for Portable Class Libraries. They allow you access to more of the framework than pcl did. You can still manually create a PCL project and reference it in a Xamarin app if you would like to use PCLs in new mobile apps with Xamarin.

Can we use xamarin.android code in xamarin.ios?

I have an app developed in xamarin.android. Now I want to develop same app in xamarin.ios. So can I use any code (classes, methods written by me) that is written for xamarin.android app in xamarin.ios app.
Yes. Code that is not platform dependent (domain, models, services, data, etc) can be placed into a PCL or shared project and used by both apps. Code that is platform dependent (UI, other device interaction) will need to be written for each platform.

How to add a component to the PCL in xamarin cross platform developement?

I have been developing a cross platform Component in Xamarin using PCL. In that I have to add the RESTSharp component to do network operations. But I am unable to add component in the PCL. Is there any other way to do that?
I found a solution.There are portable class libraries available in the NuGet package manager that can work with other platforms(android,ios) like Microsoft HTTP client.We can also define interfaces in the core library and can do the specific platform implementations in your project by using either dependency injections or IOC containers.can use MVVM light,Autofac libraries.

Using a windows.dll in a Xamarin project to deploy on an iPad

I have a C# library that I want to use in my Xamarin project to deploy to an iPad.
Lets suppose the C# library is stored as MyUtilities.dll.
For a regular Windows app, I'd add MyUtilities.dll to my project Resources and then have a
using MyUtilities;
statement in the class where I wanted to use classes from that library.
How do I accomplish this same thing using Xamarin in an iPad app?
You will need to rebuild your library from the source using the Xamarin.iOS compiler. After that you would reference the same way you do in a Windows app - by either including a Reference to the dll in your project, or by including the Library project in your solution and referencing the project.

Resources