{"id":15411945,"url":"https://github.com/zleao/zoft.mauiextensions","last_synced_at":"2025-08-03T19:31:30.500Z","repository":{"id":65484804,"uuid":"379911602","full_name":"zleao/zoft.MauiExtensions","owner":"zleao","description":"Extension library intended to be used with MAUI. Extra functionality for Views, ViewModels and Services.","archived":false,"fork":false,"pushed_at":"2024-11-20T11:15:08.000Z","size":300,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-02T03:51:02.051Z","etag":null,"topics":["csharp","dotnet","maui","net8"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zleao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-24T12:05:50.000Z","updated_at":"2024-09-19T14:15:00.000Z","dependencies_parsed_at":"2023-01-29T02:31:23.349Z","dependency_job_id":"5026038c-0b14-4ff0-9999-82eb2b29b03b","html_url":"https://github.com/zleao/zoft.MauiExtensions","commit_stats":{"total_commits":98,"total_committers":1,"mean_commits":98.0,"dds":0.0,"last_synced_commit":"dff5b5aa6a54bbea8f3707e194e4838f51c726a1"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.MauiExtensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zleao","download_url":"https://codeload.github.com/zleao/zoft.MauiExtensions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228561541,"owners_count":17937171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","dotnet","maui","net8"],"created_at":"2024-10-01T16:50:39.917Z","updated_at":"2024-12-07T04:40:34.068Z","avatar_url":"https://github.com/zleao.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zoft.MauiExtensions\n\nSet of tools designed to be used in MAUI projects, including Views, ViewModels, Services, Extensions and more...\n\nNuget Package | Current Version\n--- | ---\n| zoft.MauiExtensions.Core | [![NuGet](https://img.shields.io/nuget/v/zoft.MauiExtensions.Core.svg)](https://www.nuget.org/packages/zoft.MauiExtensions.Core/)\n\n\n## Getting Started\n\n### Install nuget package: [zoft.MauiExtensions.Core](https://www.nuget.org/packages/zoft.MauiExtensions.Core/)\n \n```\nInstall-Package zoft.MauiExtensions.Core\n```\n\n### Create Windows `MainThreadService`\n\n```csharp\nusing Microsoft.UI.Dispatching;\nusing zoft.MauiExtensions.Core.Services;\n\nnamespace \u003cyour.app.base.namespace\u003e.Platforms.Windows.Services\n{\n    public sealed class WindowsMainThreadService : MainThreadService\n    {\n        protected override DispatcherQueue MainThreadDispatcher =\u003e WinUI.App.Dispatcher;\n    }\n}\n```\n\n### Register `MainThreadService` depending on platform\n\n```csharp\nreturn builder\n    .UseMauiApp\u003cApp\u003e()\n    .ConfigureFonts(fonts =\u003e\n    {\n        fonts.AddFont(\"OpenSans-Regular.ttf\", \"OpenSansRegular\");\n        fonts.AddFont(\"OpenSans-Semibold.ttf\", \"OpenSansSemibold\");\n    })\n#if WINDOWS\n    .Services.AddSingleton\u003cIMainThreadService, Platforms.Windows.Services.WindowsMainThreadService\u003e();\n#else\n    .Services.AddSingleton\u003cIMainThreadService, MainThreadService\u003e();\n#endif\n    .Build();\n```\n\n## How To Use\nRefer to the sample to have a better understanding of package capabilities. Bellow you can find the most common features and how to use them\n\n\u003c/br\u003e\n\n### Localization Service\n\nThe package provides a set of tools to implement localization in your app:\n- `ILocalizationService`: Interface for the localization service. The interface exists to make it easier to use iwith IOC and to override the base implementation\n- `ResourceManagerLocalizationService`: Implementation of the `ILocalizationService` using resource files (*.resx*)\n```csharp\nbuilder.Services.AddSingleton\u003cILocalizationService\u003e(new ResourceManagerLocalizationService(AppResources.ResourceManager, SupportedLanguages.DefaultLanguage));\n```\n- `TranslationMarkup`: XAML markup that provides an easy way to apply the translation directly in XAML\n```xaml\n\u003cContentPage xmlns=\"http://schemas.microsoft.com/dotnet/2021/maui\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2009/xaml\"\n             xmlns:zoft=\"http://zoft.maui.extensions\"\n             x:Class=\"zoft.MauiExtensions.Sample.Views.LocalizationView\"\n             Title=\"{zoft:Translate LocalizationPage_Title}\"\u003e\n    ...\n    ...\n    \u003cScrollView\u003e\n        \u003cVerticalStackLayout Spacing=\"10\"\u003e\n            \u003cLabel Text=\"{zoft:Translate LocalizationPage_Label1}\" FontSize=\"16\" FontAttributes=\"Bold\"/\u003e\n            \u003cLabel Text=\"{zoft:Translate LocalizationPage_Label2}\" /\u003e\n            \u003cLabel Text=\"{zoft:Translate LocalizationPage_Label3}\" FontAttributes=\"Italic\" BackgroundColor=\"LightGray\"/\u003e\n        \u003c/VerticalStackLayout\u003e\n    \u003c/ScrollView\u003e\n    ...\n\u003c/ContentPage\u003e\n```\n\n\u003c/br\u003e\n\n### MainThread Service\n\nAt current time, the MAUI essentials implementation of `MainThread` is not working for Windows. This package provides a wrapper interface `IMainThreadService` and an implementation for all platforms, including Windows.\nTo use, you just need to register the correct service depending of the platform:\n```csharp\npublic sealed class WindowsMainThreadService : MainThreadService\n{\n    protected override DispatcherQueue MainThreadDispatcher =\u003e WinUI.App.Dispatcher;\n}\n```\n\n\u003c/br\u003e\n\n### Base Models\n\nBased on the Component Models of the [CommunityToolkit.MVVM](), the package provides a set of base models that can be used to create Models, ViewModels and Services in your app.\n\n- **ZoftObservableObject**: Based on the `ObservableObject` class, provides a base implementation of the `INotifyPropertyChanged` interface\n- **ZoftObservableRecipient**: Based on the `ObservableRecipient` class, provides a base implementation of the `ObservableRecipient` class\n- **ZoftObservableValidator**: Based on the `ObservableValidator` class, provides a base implementation of the `ObservableValidator` class\n    - Override `OnErrorsChanged` to handle logic when the validation results change\n\n\u003c/br\u003e\n\n### Busy Notification Management\nBase models provide methods to execute code in a background thread, while providing with updated on `IsBusy` and `BusyMessage` properties that can be bound to an UI element (i.e. `ActivityIndicator`)\n```csharp\nawait DoWorkAsync(() =\u003e ..., \"Busy Message\");\n\nvar result = await DoWorkAsync(() =\u003e return some_object, \"BusyMessage\");\n```\n\n\u003c/br\u003e\n\n### Weak Subscription\n\nThe package provides a set of extension methods to subscribe to events using weak references, avoiding memory leaks when the subscriber is not disposed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzleao%2Fzoft.mauiextensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzleao%2Fzoft.mauiextensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzleao%2Fzoft.mauiextensions/lists"}