Skip to content

Commit

Permalink
Update MD files with new naming and contents
Browse files Browse the repository at this point in the history
  • Loading branch information
Eilon committed Dec 3, 2019
1 parent 1f60549 commit 386bb84
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 134 deletions.
8 changes: 8 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Code of Conduct

This project has adopted the [Microsoft Open Source Code of
Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct
FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com)
with any additional questions or comments.
22 changes: 8 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,21 @@ with any additional questions or comments.

## Prerequisites

The only prerequisite for building, testing, and deploying from this repository
is the [.NET SDK](https://get.dot.net/).
You should install the version specified in `global.json` or a later version within
the same major.minor.Bxx "hundreds" band.
For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.310
while the 2.2.400 version would not be considered compatible by .NET SDK.
To build, test, and deploy from this repository you need the [.NET Core SDK](https://get.dot.net/).
You should install the version specified in `global.json` or a later version within the same major.minor.Bxx "hundreds" band.
For example if 2.2.300 is specified, you may install 2.2.300, 2.2.301, or 2.2.310, while the 2.2.400 version would not be considered compatible by .NET SDK.
See [.NET Core Versioning](https://docs.microsoft.com/en-us/dotnet/core/versions/) for more information.

All dependencies can be installed by running the `init.ps1` script at the root of the repository
using Windows PowerShell or [PowerShell Core][pwsh] (on any OS).

This repository can be built on Windows, Linux, and OSX.
All dependencies can be installed by running the `init.ps1` script at the root of the repository using Windows PowerShell or [PowerShell Core][pwsh] (on any OS).

## Package restore

The easiest way to restore packages may be to run `init.ps1` which automatically authenticates
to the feeds that packages for this repo come from, if any.
`dotnet restore` or `nuget restore` also work but may require extra steps to authenticate to any applicable feeds.
The easiest way to restore packages may be to run `init.ps1` which automatically authenticates to the feeds that packages for this repo come from, if any.
`dotnet restore` or `nuget restore` also work.

## Building

Building, testing, and packing this repository can be done by using the standard dotnet CLI commands (e.g. `dotnet build`, `dotnet test`, `dotnet pack`, etc.).
You can build from the command line using MSBuild or from within Visual Studio.


[pwsh]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6
138 changes: 18 additions & 120 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,33 @@
# Emblazon - Home of Experimental Mobile Blazor Bindings
# Experimental Mobile Blazor Bindings

[![Build Status](https://devdiv.visualstudio.com/Personal/_apis/build/status/xamarin.Emblazon?branchName=master)](https://devdiv.visualstudio.com/Personal/_build/latest?definitionId=12095&branchName=master)

## What is Emblazon?
## What is Experimental Mobile Blazor Bindings?

Emblazon enables using Blazor to target native UI renderers (as opposed to web/HTML renderers). This repo contains implementations that target Xamarin.Forms and Windows Forms.
Experimental Mobile Blazor Bindings is a new framework for building mobile apps using C# and .NET. Experimental Mobile Blazor Bindings uses Razor syntax to define UI components and behaviors of an application. The underlying UI components are based on Xamarin.Forms elements.

This is a sample `Hello, World!` component:

## Start Emblazoning!
```xml
<ContentPage>
<StackLayout>

### Required software to use Emblazon and for contributors
<Label Text="Hello, World!"
FontSize="20"
HorizontalTextAlignment="TextAlignment.Center" />

Emblazon and its related projects require:
</StackLayout>
</ContentPage>
```

1. [Visual Studio 2019 16.3](https://visualstudio.microsoft.com/vs/) or newer
* For Blazor Native, the Xamarin workload must be enabled in Visual Studio
* For BlinForms, you must run on Windows (that's the `in` of BlinForms!)
2. [.NET Core 3.0 SDK](https://dotnet.microsoft.com/download)

## Let's get started!

### Create a Blazor Native project
Get started by reading the [Getting Started]() document and the related walkthroughs.

1. In Visual Studio, create a Xamarin.Forms Mobile App project
1. Select the Blank app template
1. Add the Emblazon NuGet package feed by adding a new `NuGet.config` file to the solution directory:

```xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="Emblazon Feed" value="https://devdiv.pkgs.visualstudio.com/_packaging/Emblazon/nuget/v3/index.json" />
</packageSources>
</configuration>
```
## Contributing

1. In the solution's shared project (the one that isn't Android or iOS), make these changes:
1. Change the top `<Project>` node to use the Razor SDK `<Project Sdk="Microsoft.NET.Sdk.Razor">`
1. In the `<PropertyGroup>` section, add this node to set the Razor language version: `<RazorLangVersion>3.0</RazorLangVersion>`
1. Add a reference to Blazor Native in the `<ItemGroup>` containing other package references: `<PackageReference Include="Microsoft.Blazor.Native" Version="0.1.71-beta" />` (update to a newer build as needed)
1. Delete `MainPage.xaml` and `MainPage.xaml.cs`
1. Delete `App.xaml` and `App.xaml.cs`
1. Add a new class file called `App.cs` to the project
1. Add these `using` statements:

```c#
using Microsoft.MobileBlazorBindings;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Xamarin.Forms;
```

1. Replace the app class's code with this code:

```c#
public class App : Application
{
public App()
{
var host = Host.CreateDefaultBuilder()
.ConfigureServices((hostContext, services) =>
{
// Register app-specific services
})
.Build();

host.AddComponent<MainPage>(parent: this);
}

protected override void OnStart()
{
// Handle when your app starts
}

protected override void OnSleep()
{
// Handle when your app sleeps
}

protected override void OnResume()
{
// Handle when your app resumes
}
}
```

1. Add a Razor Component to the project named `_Imports.razor` with these contents:

```c#
@using Microsoft.MobileBlazorBindings.Elements
@using Xamarin.Forms
```

1. Add a Razor Component to the project named `MainPage.razor`

```html
<ContentPage>
<StackLayout>
<Button Text="Add!" OnClick="@OnAdd" />
<Label Text="@($"The button has been clicked {counter} times!")" />
</StackLayout>
</ContentPage>

@code {
int counter;

void OnAdd()
{
counter++;
}
}
```
1. You're ready to go! Run the Android or iOS project to launch your new Blazor Native-based app!


## NuGet feed

Browse the latest packages here: https://devdiv.visualstudio.com/Personal/_packaging?_a=feed&feed=Emblazon


## Solution structure

There are 3 main areas:

1. [Emblazon](src/Emblazon) - Base framework for Blazor rendering to native UI frameworks.
2. [BlinForms](src/BlinForms.Framework) - Blazor rendering to Windows Forms.
* Check out the [BlinForms sample app](samples/BlinFormsSample).
3. [Microsoft.Blazor.Native](src/Microsoft.Blazor.Native) - Blazor rendering to Xamarin.Forms.
* Check out the [Blazor Native sample todo app](samples/MobileBlazorBindingsTodo).


## Comparison projects

To compare Blazor Native with Xamarin.Forms, see the [Xamarin.Forms Todo XAML sample](samples/XamarinFormsTodoXaml/XamarinTodoXaml/XamarinTodoXaml).
As an experimental project, there are several active areas of development and we're looking for your feedback to help set the direction for this project. Please check it out and let us know any feedback you have on the project by logging issues in this repo.

Thank you!

0 comments on commit 386bb84

Please sign in to comment.