Blazor Global Events

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ก.ย. 2024
  • in this Video I show you how we can create a base class. All the types (Razor Componnents, Classed etc) that inherit this type can then subscribe to its events and also raise those. Creator: David Eggenberger Code: github.com/Dav...

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

  • @Luca_040
    @Luca_040 7 วันที่ผ่านมา

    Do not use Inheritance! You can define an Interface instead and register it as Singleton and Inject it

  • @richardaubin1951
    @richardaubin1951 11 หลายเดือนก่อน

    is there a way to do this without the copying and pasting?

  • @chukles3206
    @chukles3206 9 หลายเดือนก่อน

    How would you do it for components that already inherit something else ?

    • @chukles3206
      @chukles3206 9 หลายเดือนก่อน

      Ah got it, you can just add the static events to a Class and inject it.

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

    can I use this approach to send notifications globally on the application, but also to all users using the application? or that will need some signalr hub? I want like a notification system, that shows up on all users using the application

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

    Can I use as a global notification like Toasters which shows the error, warning, success messages ?
    Currently I am using TelerikNotification.

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

      yes you can! You can for example subsrcibe to the wanted event from the MainLayout to then show you Toast message

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

    Hey! Great stuff about Events!
    I get an error I can't quite figure out. Will you help me?
    Unhandled exception rendering component: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.
    It happens at:
    UpdateTriggered += (o, args) => ...
    (Using Blazor Server)

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

      SOLVED:
      Changed _Host.cshtml from "ServerPrerendered" to "Server"

  • @Mo-ef9yt
    @Mo-ef9yt 2 ปีที่แล้ว

    Nice

  • @charleswoodruff9013
    @charleswoodruff9013 ปีที่แล้ว

    Reset, not Resseted.