generated from jfversluis/Plugin.Maui.Feature
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example file to read in maui sample
- Loading branch information
Showing
6 changed files
with
64 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Plugin.Maui.Feature.Sample.MainPage" | ||
Title="Feature Plugin"> | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage | ||
x:Class="Plugin.Maui.Feature.Sample.MainPage" | ||
xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
Title="Feature Plugin"> | ||
|
||
<!-- Add something that makes sense for your plugin here --> | ||
<!-- Add something that makes sense for your plugin here --> | ||
<Grid Padding="20"> | ||
<Label Text="Hello" /> | ||
<Button | ||
x:Name="RunOcrBtn" | ||
Clicked="RunOcrBtn_Clicked" | ||
MaximumHeightRequest="100" | ||
MaximumWidthRequest="200" | ||
Text="Run" /> | ||
</Grid> | ||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Plugin.Maui.OCR; | ||
using Plugin.Shared.OCR; | ||
using Plugin.Maui.OCR; | ||
|
||
namespace Plugin.Maui.Feature.Sample; | ||
|
||
public static class MauiProgram | ||
{ | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<App>() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}); | ||
public static MauiApp CreateMauiApp() | ||
{ | ||
var builder = MauiApp.CreateBuilder(); | ||
builder | ||
.UseMauiApp<App>() | ||
.ConfigureFonts(fonts => | ||
{ | ||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); | ||
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); | ||
}).UseOcr(); | ||
|
||
builder.Services.AddTransient<MainPage>(); | ||
builder.Services.AddTransient<MainPage>(); | ||
|
||
return builder.Build(); | ||
} | ||
} | ||
return builder.Build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
using Plugin.Shared.OCR; | ||
using Plugin.Shared.OCR; | ||
|
||
namespace Plugin.Maui.OCR | ||
namespace Plugin.Maui.OCR; | ||
|
||
public static class OcrServiceExtensions | ||
{ | ||
public static class OcrServiceExtensions | ||
public static MauiAppBuilder UseOcr(this MauiAppBuilder builder) | ||
{ | ||
public static MauiAppBuilder UseOcr(this MauiAppBuilder builder) | ||
{ | ||
// Register the IOcrService implementation with the DI container. | ||
// This ensures that whenever IOcrService is injected, the specific platform implementation is provided. | ||
builder.Services.AddSingleton<IOcrService, OcrImplementation>(); | ||
// Register the IOcrService implementation with the DI container. | ||
// This ensures that whenever IOcrService is injected, the specific platform implementation is provided. | ||
builder.Services.AddSingleton<IOcrService, OcrImplementation>(); | ||
|
||
return builder; | ||
} | ||
return builder; | ||
} | ||
} | ||
} |