{"id":15411941,"url":"https://github.com/zleao/zoft.notificationservice","last_synced_at":"2025-03-28T03:15:24.253Z","repository":{"id":72012150,"uuid":"320675505","full_name":"zleao/zoft.NotificationService","owner":"zleao","description":"Generic C# messaging service to allow communication between modules","archived":false,"fork":false,"pushed_at":"2021-01-10T15:08:04.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-05T23:48:35.974Z","etag":null,"topics":["csharp","messaging","netstandard20","notification","pubsub","zoft"],"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":"2020-12-11T20:19:55.000Z","updated_at":"2021-01-10T15:08:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"343134bd-e131-4adb-8ad7-306b17d3c356","html_url":"https://github.com/zleao/zoft.NotificationService","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"e15e67d5796a88c83a86687e7eafa86e72f0f950"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.NotificationService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.NotificationService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.NotificationService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zleao%2Fzoft.NotificationService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zleao","download_url":"https://codeload.github.com/zleao/zoft.NotificationService/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245960814,"owners_count":20700781,"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","messaging","netstandard20","notification","pubsub","zoft"],"created_at":"2024-10-01T16:50:39.284Z","updated_at":"2025-03-28T03:15:24.200Z","avatar_url":"https://github.com/zleao.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://zleaopereira.visualstudio.com/CrossDevelopment/_apis/build/status/zoft.NavigationService?repoName=zleao%2Fzoft.NotificationService\u0026branchName=main)](https://zleaopereira.visualstudio.com/CrossDevelopment/_build/latest?definitionId=3\u0026repoName=zleao%2Fzoft.NotificationService\u0026branchName=main)\n[![NuGet](https://img.shields.io/nuget/v/zoft.NotificationService.svg)](https://www.nuget.org/packages/zoft.NotificationService/)\n\n# zoft.NotificationService\n\nGeneric C# messaging service to allow communication between different modules. Derived from the [MvxExtensions.Plugin.Notification](https://github.com/zleao/MvvmCross-Extensions/tree/master/Plugins/Notification)\n\nProvides OneWay and TwoWay message sub/pub capabilities as well as Background and UI thread message subscription. Supports delayed notifications for use cases like the resume of views (Android, iOS, etc...).\n\n### A bit of context:\n\nThis project is part of the **zoft** library, which is nothing more than an attempt to put together a set of C# utilities that I've created in my current and past projects.\n\nA lot of this code comes from another library I've developed over the years ([MvxExtensions](https://github.com/zleao/MvvmCross-Extensions)). This library was initialy built to provide some extensions and utilities that work on top of awesome [MvvmCross](https://github.com/MvvmCross/MvvmCross) and therefore I never worried to much to have a clean separation of concerns when it comes to MvvmCross libraries dependencies. **zoft** is my attempt to separate what is not MvvmCross dependent. It starts with code ported from MvxExtentions but it will not stop there...\n\n## Get started\n\n### Install Nuget Package ([zoft.NotificationService](https://www.nuget.org/packages/zoft.NotificationService/))\n\n- `Install-Package zoft.NotificationService -Version 1.0.0` \n- `dotnet add package zoft.NotificationService --version 1.0.0`\n\n### Make sure to always use the same service instance\n\nIf you're using a DI (Dependency Injection) approach, you can use the provided interface `INotificationService`. **Don't forget to register the service as singleton**. As an example: `IOContainer.RegisterSingleton\u003cINavigationService, NavigationService\u003e()`\n\nIf you're not using a DI approach, the important part is to ensure that only one instance is uses throughout the application. You might use a factory or a static property.\n\n\n## Samples\n\nYou can find a some samples in my other libraries repositories [here](https://github.com/zleao/MvvmCross-Extensions) and [here](https://github.com/zleao/zoft.TinyMvvmExtensions). Both samples are built for mobile applications using Xamarin but the usage is be similar for other platforms.\n\n\n##\n   \n## How to use\n\n### Subscribe\n```\nvar token = NotificationService.Subscribe\u003cMyMessage\u003e(HandleOneWaySubscriptionAsync);\n\nvar token = NotificationService.Subscribe\u003cMyMessage, MyResult\u003e(HandleTwoWaySubscriptionAsync);\n```\nClick [here](https://gist.github.com/zleao/cce569fe9e0f162f399e7a2e03581973) for a complete set of the possible subscription methods\n\n### Unsubscribe\n```\nNotificationService.Unsubscribe(token);\n```\nClick [here](https://gist.github.com/zleao/2aa83875f93c1ebbf866024b16ccd4ef) for a complete set of the possible unsubscription methods\n\n### Publish\n```\nNotificationService.PublishAsync(myMessage);\nNotificationService.DelayedPublishAsync(myMessage);\nNotificationService.PublishPendingNotificationsAsync(this);\n\nvar myResult = NotificationService.PublishAsync\u003cMyResult\u003e(MyMessage);\n```\nClick [here](https://gist.github.com/zleao/e8443efebb3841d774da822e73d844f9) for a complete set of the possible publish methods\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzleao%2Fzoft.notificationservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzleao%2Fzoft.notificationservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzleao%2Fzoft.notificationservice/lists"}