vendredi 24 novembre 2017

Integrate and use the BLE Plugin for Xamarin

We present in this presentation Xamarin.Forms app, that is a basic Bluetooth LE scanner. in our demonstration we will be able to:
- Check the BLE Status.
- Discover devices.
- Connect.
- Discover the services.
- Discover the characteristics.
- See characteristic details.
- Read/write and register for notifications of a characteristic.


1- Integration


2- Authorisation



3- Demo
And github : https://github.com/didourebai/BLEPluginDemo

jeudi 26 octobre 2017

Develop multi-platform and connected Apps and Deploy on Azure


Intro

PaaS allows companies, developers to focus only on applications and services and not infrastructure. PaaS provides all the services needed to create, code, deploy and run websites, mobile services, and more.
The real challenge of the Cloud is no longer infrastructure but services and mobile applications. It is now a question of conforming to a new paradigm of application, that of the "3rd platform" defined by IDC (http://vumissociety.weebly.com/uploads/2/6/7/7/26771881/idc_-_2014_predictions.pdf): the foundations of a modern application must be based on the Cloud, the mobility, exploit the Big Data and comprise social mechanics.
The Azure PaaS has evolved a lot since the first services. It meets the challenges of Apps.
It offers integration and openness unique in the market. This offer, Azure App Service, is based on 4 essential pillars detailed below: Web Apps, Mobile Apps, Logic Apps and API Apps. Not to mention the developer dimension: SDKs, APIs, openness to multiple languages, connection with all major SaaS market, etc.
And we will never forget that it includes :
  • Functions that offers you the possibility to run a code-on-demand without managing any related infrastructure, it's a "Serverless Compute Service".
  • Containerized Apps where you can deploy an open source container like Kubernetes and Docker.
  • Service Fabric dedicated to the distributed systems where you can package, deploy even manage them.
Now, with the IDE Visual Studio 2017 where it is included all that you need to start and deploy any application on Azure.
Let's say that we have Cloud Pattern and Architecture that let you build cloud application to ensure the scalability of your Apps and especially the resistant to failure.

Building the Sample

In our sample, we will upload a simple project ASP.NET Web API Core 2.0 where we integrated the EF Core 2.0 on Azure Apps.
The sample that we will deploy it is in the Marketplace:

Our sample is a simple Asp.NET Web API Core 2.0 that manage Blogs. (CRUD), it integrates EF Core 2.0 and Swagger to display the REST APIs.

1- From Visual Studio 2017

We compile in release mode, we right-click on the project in Solution Explorer after we select Publish....
We select Create new profile if we didn't initialize any settings :
In the Publish dialog, we select Microsoft Azure App Service, we select Create New and we click OK
In this part:
  • We type the Name of the App, that should be a unique name.
  • We select a subscription.
  • We select New... for the resource group and enter a name for the new Resource Group.
  • We select App Service Plan or we can create a new Plan.
  • Finally, we click on Create button... for the app service plan and select a location near you.
We have to select the Services tab to create a new database. after we select the green + icon to create a new SQL Database.
After we will configure our database by defining the Server Name, the Administrator Username, the Administrator Password.
When we confirm, we get this interface again :
We will click on Settings to continue configuring the deploy.
We click on Validate Connection to test our communication if it's established or not. After we will choose Settings to be able to check if the connection string of the database if selected or not.
After we will click on Publish.
Note that we have to do this instruction on Azure (https://portal.azure.com)to link our Web application with the database :
If we don't have a ConnectionString, we have to Add it.

2- Using FTP: Filezilla for example

We will create in this part our App service and the SQL Server Database in Azure Portal (https://portal.azure.com).
After we will use FTP/deployment username, FTP hostname and the password used in Azure.

lundi 16 octobre 2017

Xamarin.Forms UI: Pages, Layouts and Views Screen


The page is the primary container, in our sample it’s a ContentPage.
Inside the Page we will add a Layout, in the sample we use StackLayout, and inside the StackLayout we will add the view that is a list of Controls, in this sample we used: a Label, an Entry (Input text) and a Button.
1-      The “Page” can be:


1-      The “Layout” can be :
2-      The “View” is a list of controls can be :
-          Label
-          Image
-          Button
-          BoxView
-          List: to build selectable list: ListView
-          Text Entry: it can be: Entry (Text string) or Editor
-          Selection: where the user can the choice of a range of fields :
o Picker
o DatePicker
o TimePicker
o Stepper
o Slider
o Switch
-          User Feedback: to notify the user of app processing status
o ActivityIndicator
o ProgressBar.

lundi 9 octobre 2017

dimanche 20 août 2017

Mes premiers pas en Xamarin





 Installation et mise en place
a.     Windows
==>Pour Visual Studio 2015 (Update3) Ajout de Xamarin
==>Les différentes étapes d’installation Xamarin sous Visual Studio
==> Pour l’installation veuillez vérifier tous les prérequis dans le dossier Xamarin-Install-Tools.
o  Xamarin.VisualStudio_3.11.1443
o  jdk-7u71-windows-i586
o  installer_r22-windows
o  android-ndk-r10d-windows-x86 (placer le dans un dossier D : par exemple pour faire l’extraction dans le même emplacement).
o  gtk-sharp-2.12.26
o  intelhaxm-android è pour simuler l’émulateur.
Afin de vérifier l’installation, cliquez sur Tools > Options > Xamarin > Android Settings
Afin de vérifier l’installation, cliquez sur Tools > Options > Xamarin > Android Settings
En lançant Visual Studio, veuillez effectuer une mise à jour de la version Xamarin.
Tools > Options > Xamarin > Other
Lancer VS2015 et créer un nouveau projet :
File > New > Project
b.     Mac
Mac with Xcode and the Xamarin platform installed.
Si vous souhaitez cibler l'iPhone, vous aurez besoin d'un Mac. Apple exige qu'un Mac soit utilisé pour créer des applications iPhone et autres applications iOS. Vous devrez installer Xcode sur cette machine et, bien sûr, la plate-forme Xamarin qui comprend les bibliothèques nécessaires et Xamarin Studio. Vous pouvez ensuite utiliser Xamarin Studio et Xamarin.Forms sur Mac pour votre développement iPhone.
Une fois que vous avez installé Mac avec Xcode et la plate-forme Xamarin, vous pouvez également installer la plate-forme Xamarin sur un PC et un programme pour l'iPhone en utilisant Visual Studio. Le PC et Mac doivent être connectés via un réseau (comme Wi-Fi). Visual Studio communique avec le Mac via une interface Secure Shell (SSH) et utilise le Mac pour créer l'application et exécuter le programme sur un périphérique ou un simulateur.
2.     Première application Hello World J
a.     Créer une application iOS
Si vous utilisez Visual Studio, et si tout est installé correctement, vous pouvez sélectionner Fichier> Nouveau> Projet dans le menu et, dans la boîte de dialogue Nouveau projet, à gauche, sélectionnez Visual C # et iOS puis Universal (Qui se réfère au ciblage à la fois iPhone et iPad), et à partir de la liste de modèles au centre, sélectionnez Blank App (iOS).
b.     Créer une application Android
Si vous souhaitez utiliser Xamarin.Forms pour cibler les appareils Android, commencez par connaître les documents de mise en route sur le site Web de Xamarin:
Si vous utilisez Visual Studio, et si tout est installé correctement, vous pouvez sélectionner Fichier> Nouveau> Projet dans le menu, et dans la boîte de dialogue Nouveau projet, de gauche à droite, sélectionnez Visual C #, puis Android, et de La liste de modèles dans le centre, sélectionnez Blank App (Android).
3.     Créer une application Xamarin.Forms.Platform
Comment s'adapte Xamarin.Forms?
Cela signifie que vous pouvez créer une seule solution Visual Studio qui contient quatre projets C # pour obtenir les trois principales plates-formes mobiles (toutes avec accès à un PCL ou SAP), ou vous pouvez utiliser Xamarin Studio pour cibler des appareils iPhone et Android.
Le diagramme suivant illustre les interrelations entre les projets Visual Studio ou Xamarin Studio, les bibliothèques Xamarin et les API de la plate-forme. La troisième colonne se réfère à n'importe quelle plate-forme Windows basée sur Windows indépendamment du périphérique:
Les boîtes de la deuxième ligne sont les applications spécifiques à la plate-forme. Ces applications font appel au projet commun et aussi (avec l'iPhone et Android) les bibliothèques Xamarin qui implémentent les API de plate-forme native.
Mais le diagramme n'est pas tout à fait complet: il ne montre pas les appels SAP ou PCL vers la bibliothèque de classes .NET Framework. Exactement, quelle version de .NET cela dépend du code commun: un PCL a accès à sa propre version de .NET, alors qu'un SAP utilise la version de .NET incorporée dans chaque plate-forme particulière.
Xamarin a introduit Xamarin.Forms, qui vous permet d'écrire un code d'interface utilisateur qui peut être compilé pour les périphériques iOS, Android et Windows.
Xamarin.Forms supporte cinq plates-formes d'applications distinctes:
· iOS pour les programmes qui fonctionnent sur iPhone, iPad et iPod Touch.
· Android pour les programmes qui fonctionnent sur les téléphones et les tablettes Android.
· L’Universal Windows Platform (UWP) pour les applications qui s'exécutent sous Windows 10 ou Windows 10 Mobile.
· L'API Windows Runtime de Windows 8.1.
· L'API Windows Runtime de Windows Phone 8.1.
Les bibliothèques Xamarin.Forms.Core et Xamarin.Forms.Xaml implémentent l'API Xamarin.Forms. Selon la plate-forme, Xamarin.Forms.Core utilise alors une des bibliothèques Xamarin.Forms.Plat-form. Ces bibliothèques sont principalement une collection de classes appelées «renderers» qui transforment les objets d'interface utilisateur Xamarin.Forms dans l'interface utilisateur spécifique à la plate-forme.