Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aathifmahir/mauiblazorbridge

MauiBlazorBridge is Helper Utitlity That Makes Easier for Maui Blazor Hybrid Developers to Seamlessly Detect Which Platform Their Currenly Running On, Form Factor and etc..
https://github.com/aathifmahir/mauiblazorbridge

blazor blazor-hybrid formfactor maui maui-bla maui-blazor-hybrid platform

Last synced: 11 days ago
JSON representation

MauiBlazorBridge is Helper Utitlity That Makes Easier for Maui Blazor Hybrid Developers to Seamlessly Detect Which Platform Their Currenly Running On, Form Factor and etc..

Awesome Lists containing this project

README

        

# MauiBlazorBridge

MauiBlazorBridge is a Helper Utitlity That Makes Easier for Maui Blazor Hybrid Developers to Seamlessly Detect Platform, FormFactor and Etc..

|**Latest Stable** | **Latest Preview**|
| :---: | :---: |
|[![AathifMahir.Maui.MauiShakeDetector](https://img.shields.io/nuget/v/AathifMahir.MauiBlazor.MauiBlazorBridge)](https://www.nuget.org/packages/AathifMahir.MauiBlazor.MauiBlazorBridge/) | [![AathifMahir.Maui.MauiShakeDetector](https://img.shields.io/nuget/vpre/AathifMahir.MauiBlazor.MauiBlazorBridge)](https://nuget.org/packages/AathifMahir.MauiBlazor.MauiBlazorBridge/absoluteLatest) |

# Get Started

**1.** In order to use the **MauiBlazorHybrid** you need to call the extension method in your **Program.cs** file as follows:

```csharp
builder.Services.AddMauiBlazorBridge();
```

**2.** In the `_imports.razor` file, you need to import the namespace as follows:

```razor
@using MauiBlazorBridge
```

**3.** In `MainLayout.razor` file, you need to add `BridgeProvider` to Initialize the Bridge. Additionally Setting `ListenerType` Property to `Global` Makes Bridge to Listen to FormFactor Changes Globaly Instead of Creating and Disposing Listener During the Usage of `BridgeFormFactor` Component, Additionally If it is Set to `Suppressed` that would prevent Bridge from Creating a Listener Instead Get Values Once from the Device and Use Across the Bridge

```html
@inherits LayoutComponentBase




@Body





```

**Disclaimer:** When it comes PreRendering Enabled Blazor Flavor, You don't need to add `BridgeProvider` in `MainLayout.razor` file, Instead you need to add `BridgeProvider` in all the different Blazor Components that Utilizes Bridge. Additionally you need to Enable Interactivity for that Specific Component or Page, Check the [Example Here](https://github.com/AathifMahir/MauiBlazorBridge/blob/master/sample/MauiBlazorBridge.Blazor.Server.Sample/Components/Pages/BridgePage.razor)

# Usage

```html
@inject IBridge Bridge


FormFactor : Mobile




FormFactor : Tablet




FormFactor : Desktop




FormFactor : Unknown


Platform : @Bridge.Platform


Platform Version : @Bridge.PlatformVersion


FrameWork : @Bridge.Framework


```

# Components

## BridgeFormFactor

```html


FormFactor : Mobile




FormFactor : Tablet




FormFactor : Desktop




FormFactor : Unknown


```

**Recommended Approach:** To obtain the current Form Factor, bind to the `FormFactorChanged` EventCallBack in the BridgeFormFactor component as Shown in the below example

```html


FormFactor : Mobile




FormFactor : Tablet




FormFactor : Desktop




FormFactor : Unknown


@code {
private DeviceFormFactor FormFactorChanged { get; set; }
}

```

## BridgePlatform

```html


Platform : Android




Platform : iOS




Platform : Windows




Platform : MacCatalyst




Platform : Unknown


```

## BridgeFramework

```html


Framework : Maui




Framework : Blazor




```

# Note

The Documentation is Under Construction, More Features and Components will be Added Soon.

# License

MauiBlazorBridge is licensed under the **MIT** license