# Invoke .NET MAUI Code

{% hint style="warning" %}
This page only applies to **Wisej.NET Hybrid Local** applications.
{% endhint %}

Wisej.NET Hybrid Local applications can use .NET MAUI directly from within the project.

## Example Project

{% embed url="<https://github.com/iceteagroup/wisej-hybrid-examples/tree/main/PlatformCode>" %}

## Setup

To get started, add `<UseMaui>true</UseMaui>` to a Wisej.NET Hybrid Local Application **.csproj** or **.vbproj** `<PropertyGroup>`.

## Vibration Example

Triggering a vibration on a Wisej.NET button click.

```csharp
private void button1_Click(object sender, System.EventArgs e)
{
#if ANDROID || IOS
	TimeSpan vibrationLength = TimeSpan.FromSeconds(3);
	Microsoft.Maui.Devices.Vibration.Default.Vibrate(vibrationLength);
#endif
}
```

{% hint style="warning" %}
See [Vibration ](/hybrid/development/vibration.md)for setup instructions.
{% endhint %}

## Haptic Feedback Example

In Wisej.NET, all requests come in on a background thread. When invoking .NET MAUI code directly, you may need to run the call on the device's UI thread:

```csharp
private void button1_Click(object sender, System.EventArgs e)
{
#if ANDROID || IOS
	Microsoft.Maui.ApplicationModel.MainThread.BeginInvokeOnMainThread(() =>
	{						 
                 Microsoft.Maui.Devices.HapticFeedback.Default.Perform(Microsoft.Maui.Devices.HapticFeedbackType.LongPress);
        });
#endif
}
```

{% hint style="warning" %}
See [Haptic Feedback](/hybrid/development/haptic-feedback.md) for setup instructions.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/hybrid/development/invoke-.net-maui-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
