Decoupled Code with MessagingCenter in Xamarin.Forms

  Рет қаралды 12,706

Gerald Versluis

Gerald Versluis

Күн бұрын

Пікірлер: 88
@TheNewfieSoldier
@TheNewfieSoldier 3 жыл бұрын
I'm in a software intern position, and these tutorials are absolutely lifesaving, keep it up!
@jfversluis
@jfversluis 3 жыл бұрын
Wow Ian! Thank you so much for letting me know! I really appreciate that. I love helping upcoming developers get going. I hope you'll do well!
@zulfikarelran1340
@zulfikarelran1340 2 жыл бұрын
I have subscribed you channel man! 😁 Please keep continue your works, your channel is very useful.
@jfversluis
@jfversluis 2 жыл бұрын
Thank you friend 🫡 and welcome!
@draevyn
@draevyn 2 жыл бұрын
Exactly what I was looking for, huge help! Thank you!
@jfversluis
@jfversluis 2 жыл бұрын
Perfect, glad to be of help!
@rodrigosantosbarbosa629
@rodrigosantosbarbosa629 2 жыл бұрын
Hi Gerald! Thank you for this video!! 🙂
@jfversluis
@jfversluis 2 жыл бұрын
You're most welcome!
@winkstreaming2164
@winkstreaming2164 2 жыл бұрын
Thanks for this video. One thing that would be nice is if you could do a video on MVVM, but look at how MVVM is also really about apps being springy. For example the M V is also about the app always being responsive and the VM is really where the work is done. Looking at how MVVM is more from a threading an operations perspective not that silly M V VM that everyone always tries to explain.
@hadirotafoua5381
@hadirotafoua5381 3 жыл бұрын
wow this is nice .. Please can you make a video with xamarin/signalR
@yuriyholembyovskyy1223
@yuriyholembyovskyy1223 3 жыл бұрын
Hi Gerald. Great content, as always)) It would be very nice to see the comparison (features and options) of different navigation services. For example from Prism, Mvvm Light, TinyMvvM, or a custom navigation service. But without Shell navigation service
@jfversluis
@jfversluis 3 жыл бұрын
Great suggestion! But a lot of work. I'd love to do it, but not sure if I can find the time anytime soon :)
@dreamhunter2895
@dreamhunter2895 3 жыл бұрын
Sir, Please help to make one tutorial for Mobile Database Synchronization with a REST API
@jfversluis
@jfversluis 3 жыл бұрын
That's a tough one to crack :D I think everyone struggles with that one ;)
@trevorkobilo2480
@trevorkobilo2480 3 жыл бұрын
Great stuff. Would you know whether the MessagingCenter also works in Prism for Xamarin.Forms?
@jfversluis
@jfversluis 3 жыл бұрын
Thank you! I wouldn't know why it shouldn't work. You might want to check if they have something similar though. I can imagine they would have and then to have a better integration you might want to use that.
@jean-baptistedioli1692
@jean-baptistedioli1692 3 жыл бұрын
Yes, it's an interesting question about when to use the messaging center and when to use the dependency center. Did you already make the video?
@jfversluis
@jfversluis 3 жыл бұрын
I didn't make that one yet! Let me see if I can get to that :)
@andrewtruckle1695
@andrewtruckle1695 3 жыл бұрын
Slowly getting my head around this one! Thanks. Question. I have used the constructor in each page to create a send / subscribe pair. For this to work I have to define the two pages first, in reverse order, so that page 2 was already "listening" when page 1 read in the data and "sent" it. Working. I guess that is acceptable approach. The text that you had as "tick" can this be anything or must it be a complicated unique string like a GUID?
@jfversluis
@jfversluis 3 жыл бұрын
Can be anything as long as it's unique
@andrewtruckle1695
@andrewtruckle1695 3 жыл бұрын
@@jfversluis Unique within my app? Or wider scope?
@jfversluis
@jfversluis 3 жыл бұрын
Within your app. It doesn’t go anywhere. Just see it as the address that you write on a postcard. With this string it knows where to deliver
@k.koustas
@k.koustas 3 жыл бұрын
Hi Gerald, Congratulations on for your work, I love it. Would you consider to create a tutorial about Push Notifications?
@jfversluis
@jfversluis 3 жыл бұрын
Why thank you! Lovely to hear. I've had the push notification request a good number of times now :D I definitely want to do it, but it will be multi-part and more work and I can't seem to find the time just yet... I was thinking Azure NotificationHub, would that work for you?
@k.koustas
@k.koustas 3 жыл бұрын
@@jfversluis Of course this is an excellent alternative. I am looking forward to that. Thank you very much
@LobsterHarry
@LobsterHarry 3 жыл бұрын
I am using the MessagingCenter already, especially in a kind of global ErrorHandling. Very useful, but I am not sure, if it is good style to use it. Aren´t there any disadvantages ?
@jfversluis
@jfversluis 3 жыл бұрын
It's all relative and maybe in this case also dependant on if you're working on something alone or with a team. The only real disadvantage I see immediately is said loose coupling. You'll have to CTRL+F the actual message name to see where the subscriptions are and how they behave. Since those are based on strings, it's an easy thing to break but hard to track down :) So is it good style? I think a lot of people tend to avoid this if they can, but if it works for you, then it's totally fine!
@pindrusekral5428
@pindrusekral5428 Жыл бұрын
Thanks you, i read whole microsoft documentation and i still waisted 2.5 hours until you saved me.
@jfversluis
@jfversluis Жыл бұрын
Sorry you wasted some time but still glad I was able to help!
@macmcmillen6282
@macmcmillen6282 2 жыл бұрын
Late to the party so apologies if too late to post a question. How do you handle updating a page on Xamarin iOS using the OnAppearing method when that method gets called AFTER the page renders? On Android OnAppearing gets called before the page renders, so no issue there. I'm working with a Xamarin project I inherited from a previous development team. No MVVM was used. All code behind. Hope you can help. Thanks!
@jfversluis
@jfversluis 2 жыл бұрын
Never too late to post a question but not sure if this is the ideal place to do it ;) Maybe this Xamarin Community Toolkit effect can be of service: docs.microsoft.com/en-us/xamarin/community-toolkit/effects/lifecycleeffect
@macmcmillen6282
@macmcmillen6282 2 жыл бұрын
@@jfversluis Thanks very much. I greatly appreciate the reply/advice.
@JuanSebastianR21
@JuanSebastianR21 3 жыл бұрын
Always a great support, maybe something with signal R
@jfversluis
@jfversluis 3 жыл бұрын
SignalR is awesome stuff! I'll see about that one :)
@sps014
@sps014 3 жыл бұрын
Great content as always
@jfversluis
@jfversluis 3 жыл бұрын
Thanks! ☺️
@sbusisozamowakhe4470
@sbusisozamowakhe4470 2 жыл бұрын
hi , i need help with a solution on how to send different messages from the main form to...lets say to different users saved on another xemarin form
@jfversluis
@jfversluis 2 жыл бұрын
Sorry, not sure what you mean by this. If you want to send more message, repeat this process for different objects
@alexanderm8169
@alexanderm8169 3 жыл бұрын
Great Content, keep up the work! I'd love it if you could consider if you could go through an example on how to tackle libraries when you wish to for example make a scrollview horizontal and vertical and that is zoomable. Only if that is something that is intrssting for you
@jfversluis
@jfversluis 3 жыл бұрын
Hi Alexander! Thanks so much and thanks for the subscribe, appreciate it! Not sure what you mean... Are you looking for a library that offers a control that has a horizontal and vertical orientation and can be zoomed? Do I understand you correctly then? What is your use case for this if I may ask?
@alexanderm8169
@alexanderm8169 3 жыл бұрын
@@jfversluis sorry for being super unclear, I was specifically mentioning zooming and scrollview because these two wont go hand in hand in xamarin forms because one will override the other unless you use a library and create a custom render. An example could be a detailpage with an image and some text and once the image is clicked to zoom into it with a pinch. I'd be super happy if you'd consider do a video on this where you show us the fundamentals of using libraries. Downsides and upsides. Like you get a nice feature but it's not 100 percent it will update to the new release that's coming 😅.
@matt-i3r6w
@matt-i3r6w 3 жыл бұрын
If I only need to subscribe once where is the best place to put the code?
@jfversluis
@jfversluis 3 жыл бұрын
That totally depends on your code :) the constructor is usually a good place that’s only executed once
@mohamadrezamohamadi9915
@mohamadrezamohamadi9915 Жыл бұрын
Hello, please make a tutorial about sending and receiving messages in Maui
@mohamadrezamohamadi9915
@mohamadrezamohamadi9915 Жыл бұрын
I researched this topic and found out that it is not possible to receive messages in maui and only send messages. If I am correct, please give me the answer.
@jfversluis
@jfversluis Жыл бұрын
What kind of messages?
@mohamadrezamohamadi9915
@mohamadrezamohamadi9915 Жыл бұрын
@@jfversluis Send a message via phone number(SMS)
@mohamadrezamohamadi9915
@mohamadrezamohamadi9915 Жыл бұрын
@@jfversluis Is it possible to add sms receiving to my application in maui or to be able to read sms from phone messages?
@jfversluis
@jfversluis Жыл бұрын
Anything you can do with a native Android app, you can also do with .NET MAUI
@checox1909
@checox1909 3 жыл бұрын
Hii Gerald, Nice video, I want to ask you something, some days ago I was been working on an app using Xamarin Forms, I don't remember what, but I was going to use MC to do something and my boss stopped me and told me "Don't use that, is not a good code", it's not MC a good code, isn't? when can I use that and when not?
@jfversluis
@jfversluis 3 жыл бұрын
Hey Steven! I think I get what he means. I'm not sure if I mention that in this video, but I only also use it as a last resort. Using MessagingCenter causes a lot of undiscoverable code. Since you subscribe through just a string identifier you never get a good overview of where the messages are being sent or received. That might cause undesired behavior that is hard to diagnose or debug. Often times the MessagingCenter is not even needed and there is other, better ways. I don't think there is any official guidance, but use it only when reaaaaally necessary :)
@checox1909
@checox1909 2 жыл бұрын
@@jfversluis I did this question long time ago, 11 months to be exact and you answered me and I didn’t realize, sorry, but reading your answer now, I understand so much better why not use it when is not necessary, thanks god I didn’t use it at that time also 😅😅😅 and I found other ways to avoid using MC
@xamdev5975
@xamdev5975 3 жыл бұрын
I have done this 'Unsubscribe' it after it get called once but still it get called twice. Do we have any work around for this?
@jfversluis
@jfversluis 3 жыл бұрын
Kind of hard to say without any code but it calls as often as it is subscribed. Set breakpoints and see how many times it passes through there and how to make it right
@datadrop1745
@datadrop1745 3 жыл бұрын
will you please make up a detailed tutorial about Rest API(with Access tokens) get put patch delete methods for developing a xamarin forms app using MVVM approach It can be a video play list. The reason behind I am asking this, every IT solution company now-a-days is using this approach.
@jfversluis
@jfversluis 3 жыл бұрын
Please don’t post the same question under multiple videos
@phamthanhduong74
@phamthanhduong74 3 жыл бұрын
can i use messagecenter class to page ?
@jfversluis
@jfversluis 3 жыл бұрын
A page is just another class, so sure :)
@phamthanhduong74
@phamthanhduong74 3 жыл бұрын
@@jfversluis i call firebase messing service to page show display alert, i do same as you but get error cannot convert firebase messing to xamarin.form
@jfversluis
@jfversluis 3 жыл бұрын
@@phamthanhduong74 ah between Firebase and Xamarin you might have some conversion to do indeed :)
@alexanderspiegel6747
@alexanderspiegel6747 3 жыл бұрын
Unfortunately, KZbin does not allow to like the video more than once. But I would consider it as useful feature :-) Why ? There are 3 reasons: 1st "like" is for short and professional presentation of the topic 2nd "like" is for comparing advantages and disadvantages of the presented feature - message center this time 3rd "like" is for sense of humor. I believe it is very important as well. So here is my "like", Gerald. Unfortunately, only one.
@jfversluis
@jfversluis 3 жыл бұрын
Wow! Thank you Alexander! I appreciate you taking the time for letting me know, this is what I do it for. Maybe not multiple likes, but make sure you tell everyone so I can grow those subscribers then!
@alexanderspiegel6747
@alexanderspiegel6747 3 жыл бұрын
@@jfversluis I will do my best to share the info about your channel, but can’t promise immediate feedback
@jfversluis
@jfversluis 3 жыл бұрын
@@alexanderspiegel6747 haha no worries, any effort is appreciated!
@fdmomtaz
@fdmomtaz 3 жыл бұрын
me: spending 2 hours putting a "message service" together so I can pass data around Gerald: you can send a message to a subscriber me: why didn't I just search Google??!?!? WHY?? LOL
@jfversluis
@jfversluis 3 жыл бұрын
Next time search my channel first 😌
@kanishkranjan7459
@kanishkranjan7459 3 жыл бұрын
Sir plzzz make a video on how to make alarm in android. Similarly to Samsung clock. plzzzzz sir
@jfversluis
@jfversluis 3 жыл бұрын
Appreciate the idea, but I don’t think that will happen anytime soon. Sorry :(
@kanishkranjan7459
@kanishkranjan7459 3 жыл бұрын
@@jfversluis Okay
@moatasemkremed5395
@moatasemkremed5395 3 жыл бұрын
MVVM Please 🙏
@jfversluis
@jfversluis 3 жыл бұрын
Did you see this one by James? kzbin.info/www/bejne/hqTSYoCbjcR7rKs
@alexmidnayt159
@alexmidnayt159 3 жыл бұрын
MVVM & MessagingCenter?) realy?
@jfversluis
@jfversluis 3 жыл бұрын
Not sure what you mean there Alex?
@alexmidnayt159
@alexmidnayt159 3 жыл бұрын
@@jfversluis No? what about this - using MC will broke MVVM pattern logic!
@jfversluis
@jfversluis 3 жыл бұрын
Absolutely! But I think this person asks for a video about MVVM not about a combination of MVVM and MessagingCenter. At least that’s not clear. Additionally, with the Xamarin paradigm there is more places where you can use the MessagingCenter that go way beyond the MVVM pattern that is only applied on your shared logic
@EdRawrDev5813
@EdRawrDev5813 3 жыл бұрын
you should use UwU instead of :-))
@jfversluis
@jfversluis 3 жыл бұрын
Help me out... UwU?
@EdRawrDev5813
@EdRawrDev5813 3 жыл бұрын
@@jfversluis it's like :-)) but for young fellas , more fresh and kawaii
@jfversluis
@jfversluis 3 жыл бұрын
I had to Google it. Now I feel old...
@EdRawrDev5813
@EdRawrDev5813 3 жыл бұрын
@@jfversluis you are priceless sir Gerald ☠️🖤
@csababorbely3453
@csababorbely3453 Жыл бұрын
is there any prerequisites for xamarin in this messagincenter? im devoloping a maui app and im surprised why xamarin.from isnt "found" ....
@jfversluis
@jfversluis Жыл бұрын
Xamarin and Xamarin.Forms as a name is gone. The MessagingCenter is still in .NET MAUI, but deprecated. The performance is horrible have a look at the MVVM Toolkit one
@csababorbely3453
@csababorbely3453 Жыл бұрын
shit ok thse are nuget packagese. but should i take every? or just core is enough for messaging
@csababorbely3453
@csababorbely3453 Жыл бұрын
@@jfversluis thank you!
Input Validation in Xamarin.Forms with Xamarin.CommunityToolkit
16:32
Gerald Versluis
Рет қаралды 14 М.
Xamarin.Forms ListView - Everything you need to know (& .NET MAUI)
36:49
James Montemagno
Рет қаралды 63 М.
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 17 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
Don’t Choose The Wrong Box 😱
00:41
Topper Guild
Рет қаралды 39 МЛН
Как Я Брата ОБМАНУЛ (смешное видео, прикол, юмор, поржать)
00:59
Dependency Injection | Prime Reacts
28:34
ThePrimeTime
Рет қаралды 356 М.
Real-World Input Validation Scenarios with Xamarin.CommunityToolkit
20:07
Amazing Data Visualization with CarouselView in Xamarin.Forms
18:16
Gerald Versluis
Рет қаралды 16 М.
Custom Fonts & Font Icons/Images in Xamarin.Forms
20:18
James Montemagno
Рет қаралды 22 М.
I never understood why you can't go faster than light - until now!
16:40
FloatHeadPhysics
Рет қаралды 4,2 МЛН
Create Custom Controls using BindableProperty for Xamarin.Forms
17:48
Gerald Versluis
Рет қаралды 16 М.
Secure Your Xamarin App with Fingerprint or Face Recognition
24:02
Gerald Versluis
Рет қаралды 19 М.
Clean Code is SLOW But REQUIRED? | Prime Reacts
28:22
ThePrimeTime
Рет қаралды 324 М.
How to Add a Database to Xamarin & .NET MAUI apps with SQLite-net
23:13
James Montemagno
Рет қаралды 78 М.
Advent of Neovim: Why Neovim?
10:21
TJ DeVries
Рет қаралды 34 М.
I thought one thing and the truth is something else 😂
00:34
عائلة ابو رعد Abo Raad family
Рет қаралды 17 МЛН