All Projects → jamiewest → XamarinHosting

jamiewest / XamarinHosting

Licence: MIT license
Xamarin Forms Generic Host implementation for Microsoft.Extensions.Hosting.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to XamarinHosting

DevOpsExamples
A repo to show you how to use a private NuGet feed, such as Telerik, to restore packages in Azure DevOps, GitHub Actions, GitLab CI and AppCenter.
Stars: ✭ 16 (-15.79%)
Mutual labels:  xamarin, nuget, xamarin-forms
Xamarin.Forms.MultiSelectListView
☑️ Select multiple rows in a listview with xamarin.forms
Stars: ✭ 61 (+221.05%)
Mutual labels:  nuget, xamarin-forms, xamarin-library
ButtonCirclePlugin
Circle Buttons with icon for your Xamarin.Forms Applications
Stars: ✭ 96 (+405.26%)
Mutual labels:  xamarin, nuget, xamarin-forms
VersionTrackingPlugin
Version Tracking Plugin for Xamarin and Windows
Stars: ✭ 62 (+226.32%)
Mutual labels:  xamarin, nuget, xamarin-forms
Latestversionplugin
LatestVersion Plugin for Xamarin and Windows apps
Stars: ✭ 99 (+421.05%)
Mutual labels:  xamarin, nuget, xamarin-forms
ScreenshotPlugin
A simple Screenshot plugin for Xamarin and Windows to get and save screenshot in yours apps.
Stars: ✭ 32 (+68.42%)
Mutual labels:  xamarin, nuget, xamarin-forms
Xamarin.forms.inputkit
CheckBox, Radio Button, Labeled Slider, Dropdowns etc.
Stars: ✭ 372 (+1857.89%)
Mutual labels:  xamarin, nuget, xamarin-forms
XamarinClipboardPlugin
Cross Platform Clipboard access for Xamarin
Stars: ✭ 24 (+26.32%)
Mutual labels:  xamarin, xamarin-forms, xamarin-library
Xamarin.plugins
Cross-platform Native API Access from Shared Code!
Stars: ✭ 1,176 (+6089.47%)
Mutual labels:  xamarin, nuget, xamarin-forms
Xxamarin
Repositório com ✨ 141 Exemplos de Implementações e 📦 13 Pacotes de Xamarin
Stars: ✭ 68 (+257.89%)
Mutual labels:  xamarin, nuget, xamarin-forms
Mvvmcross
The .NET MVVM framework for cross-platform solutions, including Xamarin.iOS, Xamarin.Android, Windows and Mac.
Stars: ✭ 3,594 (+18815.79%)
Mutual labels:  xamarin, nuget, xamarin-forms
Plugin.audiorecorder
Audio Recorder plugin for Xamarin and Windows
Stars: ✭ 140 (+636.84%)
Mutual labels:  xamarin, nuget, xamarin-forms
Xamarinmediamanager
Cross platform Xamarin plugin to play and control Audio and Video
Stars: ✭ 647 (+3305.26%)
Mutual labels:  xamarin, nuget, xamarin-forms
Xamarin.forms.breadcrumb
This is a breadcrumb navigation control that is complete automatic and uses the Navigation stack and page titles to generate the breadcrumbs.
Stars: ✭ 130 (+584.21%)
Mutual labels:  xamarin, nuget, xamarin-forms
Prototype.Forms.Controls
This sample app contains a random mixture of Xamarin/Xamarin.Forms controls, views, and functionality snippets that I've created.
Stars: ✭ 21 (+10.53%)
Mutual labels:  xamarin, xamarin-forms, xamarin-library
YoApp
YoApp, messaging suite with batteries included!
Stars: ✭ 17 (-10.53%)
Mutual labels:  xamarin, xamarin-forms
EntryCustomReturnPlugin
Xamarin.Forms Plugin to customize the Xamarin.Forms.Entry Keyboard Return Button
Stars: ✭ 81 (+326.32%)
Mutual labels:  nuget, xamarin-forms
Cognitive-Face-Xamarin
A client library that makes it easy to work with the Microsoft Cognitive Services Face API on Xamarin.iOS, Xamarin.Android, and Xamarin.Forms and/or Portable Class Libraries.
Stars: ✭ 18 (-5.26%)
Mutual labels:  xamarin, xamarin-forms
XamarinPipelineDemo
Demo and explanation on how to do several common tasks for Xamarin.Forms Android in an Azure DevOps pipeline on a Microsoft-hosted agent. Tasks include: build-based version, APK signing, publishing artifacts, unit tests, and UI tests (both via emulator in Azure DevOps and via real devices in App Center).
Stars: ✭ 23 (+21.05%)
Mutual labels:  xamarin, xamarin-forms
XamarinFormsPinView
PIN keyboard for Xamarin.Forms.
Stars: ✭ 83 (+336.84%)
Mutual labels:  xamarin-forms, xamarin-library

This archive is not actively maintained and has become outdated, I will try to update when I am able. Please also see the following reasources regarding using a Generic Host in Xamarin Forms.

Add ASP.NET Core's Dependency Injection into Xamarin Apps with HostBuilder

Another example from James

Xamarin.Forms Generic Host

Build status

A Xamarin.Forms generic host implementation for Microsoft.Extensions.Hosting.

Installation

You can add this library to your project using NuGet.

Package Manager Console Run the following command in the “Package Manager Console”:

PM> Install-Package West.Extensions.XamarinHosting

Visual Studio Right click to your project in Visual Studio, choose “Manage NuGet Packages” and search for ‘West.Extensions.XamarinHosting’ and click ‘Install’.

.NET Core Command Line Interface Run the following command from your favorite shell or terminal:

dotnet add package West.Extensions.XamarinHosting

Usage

Create a new Xamarin.Forms project and modify the following files to look like the examples below:

App.xaml.cs

public partial class App : Application
{
    public App() => InitializeComponent();

    public App(IHost host) : this() => Host = host;

    public static IHost Host { get; private set; }

    public static IHostBuilder BuildHost() => 
        XamarinHost.CreateDefaultBuilder<App>()
        .ConfigureServices((context, services) => 
        {
            services.AddScoped<MainPage>();
        });

    protected override void OnStart()
    {
        Task.Run(async () => await Host.StartAsync());
        MainPage = Host.Services.GetRequiredService<MainPage>();
    }

    protected override void OnSleep()
    {
        Task.Run(async () => await Host.SleepAsync());
    }

    protected override void OnResume()
    {
        Task.Run(async () => await Host.ResumeAsync());
    }
}

Android MainActivity.cs

protected override void OnCreate(Bundle savedInstanceState)
{
    ...

    // Android requires that we set content root.
    var host = App.BuildHost()
        .UseContentRoot(System.Environment.GetFolderPath(
            System.Environment.SpecialFolder.Personal)).Build();

    var application = host.Services.GetRequiredService<App>();

    LoadApplication(application);

    ...
}

iOS AppDelegate.cs

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    ...

    var host = App.BuildHost().Build();

    var application = host.Services.GetRequiredService<App>();

    LoadApplication(application);

    ...
}

Documentation

Docs are a work in progress, they can be found here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].