Decoupled Code with MessagingCenter in Xamarin.Forms

Опубликовано: 04 Октябрь 2024
на канале: Gerald Versluis
12,647
391

With MessagingCenter in Xamarin.Forms you gain a publish-subscriber system out of the box. With this you can send messages across your application and execute code while doing so. This allows you to loosely couple your code in certain areas, but it comes with a couple of gotchas!

In this video we will learn what it's all about and what to be aware of.

💝 Join this channel to get access to perks:
https://www.youtube.com/channel/Geral...

🛑 Don't forget to subscribe to my channel for more amazing content: https://www.youtube.com/GeraldVerslui...

🐦 Follow me on Twitter:   / jfversluis  

🔗 Links
Sample code Repo: https://github.com/jfversluis/XFMessa...
MessagingCenter Docs: https://docs.microsoft.com/xamarin/xa...

Databinding Playlist:    • Everything You Need on .NET MAUI & Xa...  

Xamarin Forms Repo: https://github.com/xamarin/Xamarin.Forms

⏱ Timestamps
0:00 Intro
0:36 Sample App Outline
1:25 Implement Sample App UI
4:10 Implement Sample Code
4:30 Explore MessagingCenter APIs
6:13 Important Note on Memory Leaks!
6:58 Implement MessagingCenter.Subscribe
13:30 Implement MessagingCenter.Send
15:00 Run Sample App And See Results!
16:08 Important Note On Duplicate Subscriptions!
17:08 Outro

🎥 Video edited with Camtasia (ref): https://techsmith.z6rjha.net/AJoeD

🙋‍♂️ Also find my...
Twitter:   / jfversluis  
Blog: https://blog.verslu.is
Twitch:   / jfversluis  
All the rest: https://jfversluis.dev

#XamarinForms #MessagingCenter #Xamarin #pubsub