Using DependencyService in Xamarin.Forms to Write Platform-Specific Code

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024

ความคิดเห็น • 62

  • @_samirdahal
    @_samirdahal 3 ปีที่แล้ว +5

    Get():Returns the platform-specific implementation
    Resolve():The method to use to resolve dependencies by type.
    Source:
    forums.xamarin.com/discussion/157688/what-is-the-difference-between-get-and-resolve-in-xamarin-forms-dependencyservice

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      Awesome Samir! Thank you! Will pin this to the video so now everyone can learn

    • @_samirdahal
      @_samirdahal 3 ปีที่แล้ว +2

      @@jfversluis Thank you for pinning this.

  • @phw1009
    @phw1009 3 ปีที่แล้ว +1

    You are the only hope in Xamarin youtube world...
    Need... more... Instruction.... Samples... References....

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      Haha thank you! Trying my best! But why is there only 24 hours in a day?!

    • @phw1009
      @phw1009 3 ปีที่แล้ว

      @@jfversluis Cheers from korea

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +2

      Also be sure to check out David Ortinau’s channel with 60 second tutorials! th-cam.com/play/PLrkKvY7K4dLWNQQlJAlf6CgVt5hDtU4Xb.html

  • @courseprovider9871
    @courseprovider9871 3 ปีที่แล้ว +1

    Thanks man this is great vid. This question being asked to me in job interview.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Oh really?! And did you get it right? At least now you will ;)

  • @rockdrummer3999
    @rockdrummer3999 2 ปีที่แล้ว

    IVE BEEN LOOKING FOR THIS VIDEO FOR HOURS THANK YOU

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว +1

      IT WAS RIGHT HERE! Glad you found it useful!

  • @mohammadradwan752
    @mohammadradwan752 3 ปีที่แล้ว +1

    Thank you Gerald you always make life easier

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      That's the idea! Thank you :D

  • @argonjs
    @argonjs 3 ปีที่แล้ว

    When I forget something or need a better understanding here I have a better explanation video on your channel! Thanks for saving many hours

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      Happy to help!

  • @EdRawrDev5813
    @EdRawrDev5813 2 ปีที่แล้ว

    delightful as always sir Gerald

  • @w9w99ww9
    @w9w99ww9 3 ปีที่แล้ว

    Thank you for this non-stop teaching video, I will try to follow your step~~,

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Please do! And it's totally my pleasure, so much fun. Thank you for following me!

  • @4Asteria
    @4Asteria 3 ปีที่แล้ว

    Thank you very much, its much easier to understand if your explain with words and code

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Thank you! So, just to be clear: this video was helpful? Or would you like to see something different? :)

    • @4Asteria
      @4Asteria 3 ปีที่แล้ว +1

      It was helpful. I like how you explain and show the topics

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      @@4Asteria wonderful! Thank you for letting me know :)

  • @chindil1
    @chindil1 3 ปีที่แล้ว

    Thanks Gerald.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Thank you for watching!

  • @jonasclarebout
    @jonasclarebout 2 ปีที่แล้ว

    Great info as always , love the structure you put in your videos , makes it very easy to follow )

    • @jfversluis
      @jfversluis  2 ปีที่แล้ว +1

      Thanks so much Jonas!

  • @bestprogramming5118
    @bestprogramming5118 3 ปีที่แล้ว +1

    Great Sir....This was headache for me thanks sir

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Glad I could relieve you from that! 😄

    • @marvinxulu7816
      @marvinxulu7816 3 ปีที่แล้ว

      lol same.

  • @jennychen2105
    @jennychen2105 3 ปีที่แล้ว +1

    Please do a video on using Autofac dependency injection with Xamarin Forms. And possibly on 3rd party MVVM frameworks like Prism.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      Those are on the list, thank you!

  • @josiahtmahachi7291
    @josiahtmahachi7291 3 ปีที่แล้ว

    Thank you from 🇿🇼

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      I love having viewers from far places! You're very welcome from 🇳🇱

  • @KeNoShi850
    @KeNoShi850 3 ปีที่แล้ว

    Thank's for video it's great :)

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Thank you Kacper!

    • @KeNoShi850
      @KeNoShi850 3 ปีที่แล้ว

      @@jfversluis can you create video about databases with xamarin forms? E.g SQLite

  • @cyrildouglas9262
    @cyrildouglas9262 3 ปีที่แล้ว +1

    Thank you Gerald for this great video, can you do a video on MvvmCross in Xamarin Forms? also do you prefer using Mvvm Frameworks in Xamarin forms? I heard some people say using them in Xamarin is not recommended.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      Do you have any sources on those people not recommending it? I would be curious to read about it! I do use it, I have almost always exclusively used FreshMvvm, do you know about that one?

    • @cyrildouglas9262
      @cyrildouglas9262 3 ปีที่แล้ว +1

      @@jfversluis Actually I saw it in the answers of StackOverflow that unfortunately, I can't seem to find at the moment as it was several days ago, Yes I heard of FreshMvvm but never gave it a chance as it designed especially for xamarin forms rather than cross-platform, cause I coming from developing desktop apps and I used MvvmLight and MvvmCross only.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      Ah gotcha! Yeah that’s true, it’s specifically for Forms. That’s what I like about it. Other frameworks are definitely good, but not designed with Forms in mind. I’ll have a look at some other frameworks and make videos!

    • @cyrildouglas9262
      @cyrildouglas9262 3 ปีที่แล้ว

      @@jfversluis There might be a time when we want only one business logic project and we just want to swap the UI projects, that is what I've done in my projects and now I want to build mobile apps with these logic projects without the need of changing code which is what cross-platform frameworks shine, thanks for your all your efforts once again it would be good if you do a project using MvvmCross, thanks again.

  • @pramodpatil4148
    @pramodpatil4148 3 ปีที่แล้ว +1

    Gerald, when to use Dependency service and Messaging Center? Both of them are used to invoke platform code.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      Very interesting question! Do you mind waiting for the answer a little so I make a video about it? 😄

    • @pramodpatil4148
      @pramodpatil4148 3 ปีที่แล้ว

      @@jfversluis That would be better. I will wait.

  • @4Asteria
    @4Asteria 3 ปีที่แล้ว

    Hello again,
    One question.
    Can I use the Xamarin.Forms DependencyService for Dependendy Injection?
    Just like you explained in your video "Dependency Injection for Absolute Beginners with C# and .NET"?
    Kind regards

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      It doesn't support that right now, no :( in .NET MAUI they move to the built-in Dependency Injection which does have that!

  • @dariodusper7068
    @dariodusper7068 3 ปีที่แล้ว

    How ti inject services into viewmodels from a root place ???

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว

      You probably want to use some kind of framework for that like AutoFac :)

  • @andrewtruckle1695
    @andrewtruckle1695 3 ปีที่แล้ว

    Thanks for the tutorial which has been a great help. Now I need to try and apply that to my StackOverflow question here stackoverflow.com/q/66295413/2287576 concerning saving the window position on macOS. In the comments the following was suggested: "Forms itself won't do it, but you should be able to use the Mac API from a custom renderer or dependency service to do it".

    • @andrewtruckle1695
      @andrewtruckle1695 3 ปีที่แล้ว

      It turned out that I was able to handle this issue without a DependencyService. All I needed to do was modify my AppDelegate. I added an answer to my SO question.
      A tutorial that would be appreciated, if not already covered, it how to write a RestorationClass for a single window macOS app so that when you also use the Restorable property it will re-display the window again.

    • @jfversluis
      @jfversluis  3 ปีที่แล้ว +1

      I have no experience with that whatsoever! So maybe you make a tutorial about it this time :P

    • @andrewtruckle1695
      @andrewtruckle1695 3 ปีที่แล้ว

      @@jfversluis Maybe! At the moment I have just got my head around Codesigning the macOS release build, and notarizing the package. Now I am working on localization into Italian (via a friend). It is a pity the RESX file has to be manually edited. But it works! Hopefully I have work out the RestorationClass with time.